class Speculations::Parser::Context::Example
Attributes
lnb[R]
parent[R]
title[R]
Public Class Methods
new(lnb:, parent:, title:)
click to toggle source
# File lib/speculations/parser/context/example.rb, line 24 def initialize(lnb:, parent:, title:) @lnb = lnb @parent = parent @title = _compute_title(title) end
Public Instance Methods
add_line(line)
click to toggle source
# File lib/speculations/parser/context/example.rb, line 6 def add_line line lines << line self end
lines()
click to toggle source
# File lib/speculations/parser/context/example.rb, line 11 def lines @__lines__ ||= [] end
to_code()
click to toggle source
# File lib/speculations/parser/context/example.rb, line 15 def to_code parent.map_lines(_example_head) + parent.map_lines(lines, indent: 1) + parent.map_lines("end") end
Private Instance Methods
_compute_title(title)
click to toggle source
# File lib/speculations/parser/context/example.rb, line 30 def _compute_title(title) "#{title} (#{parent.root.filename}:#{lnb})" end
_example_head()
click to toggle source
# File lib/speculations/parser/context/example.rb, line 34 def _example_head %{it "#{title}" do} end