Class: Nopoint::Chapter
- Inherits:
-
Object
- Object
- Nopoint::Chapter
- Defined in:
- lib/nopoint/chapter.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#slides ⇒ Object
Returns the value of attribute slides.
Instance Method Summary collapse
-
#initialize(id, file) ⇒ Chapter
constructor
A new instance of Chapter.
Constructor Details
#initialize(id, file) ⇒ Chapter
Returns a new instance of Chapter.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nopoint/chapter.rb', line 7 def initialize(id, file) @id = id @slides = [] source = File.read(file) if source =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m # remove the matched header source = $' self.data = YAML.safe_load($1) else self.data = Hash.new end source.split(/\* ?\* ?\*/).each do || @slides << Nopoint::Slide.new() end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/nopoint/chapter.rb', line 5 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/nopoint/chapter.rb', line 5 def id @id end |
#slides ⇒ Object
Returns the value of attribute slides.
5 6 7 |
# File 'lib/nopoint/chapter.rb', line 5 def @slides end |