artdaq_node_server  v1_00_07
 All Classes Namespaces Files Variables Pages
XMLProcessingInstruction.js
1 // Generated by CoffeeScript 1.9.1
2 (function() {
3  var XMLProcessingInstruction, create;
4 
5  create = require('lodash/create');
6 
7  module.exports = XMLProcessingInstruction = (function() {
8  function XMLProcessingInstruction(parent, target, value) {
9  this.stringify = parent.stringify;
10  if (target == null) {
11  throw new Error("Missing instruction target");
12  }
13  this.target = this.stringify.insTarget(target);
14  if (value) {
15  this.value = this.stringify.insValue(value);
16  }
17  }
18 
19  XMLProcessingInstruction.prototype.clone = function() {
20  return create(XMLProcessingInstruction.prototype, this);
21  };
22 
23  XMLProcessingInstruction.prototype.toString = function(options, level) {
24  var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
25  pretty = (options != null ? options.pretty : void 0) || false;
26  indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
27  offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
28  newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
29  level || (level = 0);
30  space = new Array(level + offset + 1).join(indent);
31  r = '';
32  if (pretty) {
33  r += space;
34  }
35  r += '<?';
36  r += this.target;
37  if (this.value) {
38  r += ' ' + this.value;
39  }
40  r += '?>';
41  if (pretty) {
42  r += newline;
43  }
44  return r;
45  };
46 
47  return XMLProcessingInstruction;
48 
49  })();
50 
51 }).call(this);