Class: ReVIEW::InlineElementNode
- Defined in:
- lib/review/node.rb,
lib/review/compiler.rb
Instance Attribute Summary collapse
-
#compiler ⇒ Object
readonly
Returns the value of attribute compiler.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#initialize(compiler, position, symbol, content) ⇒ InlineElementNode
constructor
A new instance of InlineElementNode.
- #to_doc ⇒ Object
- #to_json ⇒ Object
- #to_raw ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(compiler, position, symbol, content) ⇒ InlineElementNode
Returns a new instance of InlineElementNode.
1013 1014 1015 1016 1017 1018 |
# File 'lib/review/compiler.rb', line 1013 def initialize(compiler, position, symbol, content) @compiler = compiler @position = position @symbol = symbol @content = content end |
Instance Attribute Details
#compiler ⇒ Object (readonly)
Returns the value of attribute compiler.
1019 1020 1021 |
# File 'lib/review/compiler.rb', line 1019 def compiler @compiler end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
1022 1023 1024 |
# File 'lib/review/compiler.rb', line 1022 def content @content end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
1020 1021 1022 |
# File 'lib/review/compiler.rb', line 1020 def position @position end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
1021 1022 1023 |
# File 'lib/review/compiler.rb', line 1021 def symbol @symbol end |
Instance Method Details
#to_doc ⇒ Object
136 137 138 139 |
# File 'lib/review/node.rb', line 136 def to_doc #content_str = super @compiler.compile_inline(@symbol, @content) end |
#to_json ⇒ Object
141 142 143 144 145 146 |
# File 'lib/review/node.rb', line 141 def to_json '{"ruleName":"' + self.class.to_s.sub(/ReVIEW::/,"").sub(/Node$/,"") + '",' + %Q|"symbol":"#{@symbol}",| + "\"offset\":#{position.pos},\"line\":#{position.line},\"column\":#{position.col}," + (@concat ? '"childNodes":[' + @content.map(&:to_json).join(",") + ']' : '"childNodes":[]') + '}' end |
#to_raw ⇒ Object
131 132 133 134 |
# File 'lib/review/node.rb', line 131 def to_raw content_str = super "@<#{@symbol}>{#{content_str}}" end |