Class: TermNote::Loader
- Inherits:
-
Object
- Object
- TermNote::Loader
- Defined in:
- lib/termnote/loader.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
Instance Method Summary collapse
-
#initialize(file) ⇒ Loader
constructor
A new instance of Loader.
- #to_panes ⇒ Object
Constructor Details
#initialize(file) ⇒ Loader
Returns a new instance of Loader.
5 6 7 8 9 10 11 |
# File 'lib/termnote/loader.rb', line 5 def initialize(file) if YAML.parse(file) @documents = YAML.load_stream(file) else raise "not a yaml file?" end end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
3 4 5 |
# File 'lib/termnote/loader.rb', line 3 def document @document end |
Instance Method Details
#to_panes ⇒ Object
13 14 15 16 17 18 |
# File 'lib/termnote/loader.rb', line 13 def to_panes @documents.map do |document| type = document['type'] send type, document end end |