Class: Leg::Page
- Inherits:
-
Object
- Object
- Leg::Page
- Defined in:
- lib/leg/page.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#footer_text ⇒ Object
Returns the value of attribute footer_text.
-
#steps ⇒ Object
Returns the value of attribute steps.
Instance Method Summary collapse
- #<<(step) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(filename = "tutorial") ⇒ Page
constructor
A new instance of Page.
- #title ⇒ Object
Constructor Details
#initialize(filename = "tutorial") ⇒ Page
Returns a new instance of Page.
5 6 7 8 9 |
# File 'lib/leg/page.rb', line 5 def initialize(filename = "tutorial") @filename = filename @steps = [] @footer_text = nil end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
3 4 5 |
# File 'lib/leg/page.rb', line 3 def filename @filename end |
#footer_text ⇒ Object
Returns the value of attribute footer_text.
3 4 5 |
# File 'lib/leg/page.rb', line 3 def @footer_text end |
#steps ⇒ Object
Returns the value of attribute steps.
3 4 5 |
# File 'lib/leg/page.rb', line 3 def steps @steps end |
Instance Method Details
#<<(step) ⇒ Object
11 12 13 14 |
# File 'lib/leg/page.rb', line 11 def <<(step) @steps << step self end |
#empty? ⇒ Boolean
16 17 18 |
# File 'lib/leg/page.rb', line 16 def empty? @steps.empty? end |
#title ⇒ Object
20 21 22 23 24 25 |
# File 'lib/leg/page.rb', line 20 def title first_line = @steps.first ? @steps.first.text.lines.first : (@footer_text ? @footer_text.lines.first : nil) if first_line && first_line.start_with?("# ") first_line[2..-1].strip end end |