Sha256: 52af007680e3388076c47e95e8269d0699576cc8deaf6c9e2f4475f1f7fce15c
Contents?: true
Size: 570 Bytes
Versions: 1
Compression:
Stored size: 570 Bytes
Contents
module TermNote class Loader attr_accessor :document def initialize(file) if YAML.parse(file) @documents = YAML.load_stream(file) else raise "not a yaml file?" end end def to_panes @documents.map do |document| type = document['type'] case type when "chapter" then Pane::Chapter.new document when "code" then Pane::Code.new document when "list" then Pane::List.new document when "text" then Pane::Text.new document end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
termnote-1.0.0 | lib/termnote/loader.rb |