Class: Speculations::Parser::Context::Example
- Inherits:
-
Object
- Object
- Speculations::Parser::Context::Example
- Defined in:
- lib/speculations/parser/context/example.rb
Constant Summary collapse
- NAMED_EXAMPLE =
%r{\A[`~]{3,}ruby\s+:example\s+(.*)}
Instance Attribute Summary collapse
-
#lnb ⇒ Object
readonly
Returns the value of attribute lnb.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
Instance Attribute Details
#lnb ⇒ Object (readonly)
Returns the value of attribute lnb.
3 4 5 |
# File 'lib/speculations/parser/context/example.rb', line 3 def lnb @lnb end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/speculations/parser/context/example.rb', line 3 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/speculations/parser/context/example.rb', line 3 def parent @parent end |
Instance Method Details
#add_line(line) ⇒ Object
7 8 9 10 |
# File 'lib/speculations/parser/context/example.rb', line 7 def add_line line lines << line self end |
#lines ⇒ Object
12 13 14 |
# File 'lib/speculations/parser/context/example.rb', line 12 def lines @__lines__ ||= [] end |
#to_code ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/speculations/parser/context/example.rb', line 16 def to_code parent.map_lines(_example_head) + "\n" + parent.map_lines(lines, indent: 1) + "\n" + parent.map_lines("end") end |