Class: TermNote::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/termnote/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#documentObject

Returns the value of attribute document.



3
4
5
# File 'lib/termnote/loader.rb', line 3

def document
  @document
end

Instance Method Details

#to_panesObject



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