Class: ReVIEW::CodeBlockElementNode
- Defined in:
- lib/review/node.rb,
lib/review/compiler.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#compiler ⇒ Object
readonly
Returns the value of attribute compiler.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Instance Method Summary collapse
-
#initialize(compiler, position, name, args, content) ⇒ CodeBlockElementNode
constructor
A new instance of CodeBlockElementNode.
- #parse_args(*patterns) ⇒ Object
- #raw_lines ⇒ Object
- #to_doc ⇒ Object
Methods inherited from Node
#inspect, #to_json, #to_raw, #to_s_by
Constructor Details
#initialize(compiler, position, name, args, content) ⇒ CodeBlockElementNode
Returns a new instance of CodeBlockElementNode.
913 914 915 916 917 918 919 |
# File 'lib/review/compiler.rb', line 913 def initialize(compiler, position, name, args, content) @compiler = compiler @position = position @name = name @args = args @content = content end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
923 924 925 |
# File 'lib/review/compiler.rb', line 923 def args @args end |
#compiler ⇒ Object (readonly)
Returns the value of attribute compiler.
920 921 922 |
# File 'lib/review/compiler.rb', line 920 def compiler @compiler end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
924 925 926 |
# File 'lib/review/compiler.rb', line 924 def content @content end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
922 923 924 |
# File 'lib/review/compiler.rb', line 922 def name @name end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
921 922 923 |
# File 'lib/review/compiler.rb', line 921 def position @position end |
Instance Method Details
#parse_args(*patterns) ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/review/node.rb', line 114 def parse_args(*patterns) patterns.map.with_index do |pattern, i| if @args[i] @args[i].__send__("to_#{pattern}") else nil end end end |
#raw_lines ⇒ Object
124 125 126 |
# File 'lib/review/node.rb', line 124 def raw_lines self.content.to_doc.split(/\n/) end |
#to_doc ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/review/node.rb', line 103 def to_doc # content_str = super args = @args.map(&:to_doc) if @content content_lines = raw_lines else content_lines = nil end @compiler.compile_command(@name, @args, content_lines, self) end |