Sha256: a92696ed7651aad9055b2335c309f770be31178b2d4078b34b8adb0219beaceb

Contents?: true

Size: 358 Bytes

Versions: 2

Compression:

Stored size: 358 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']
        send type, document
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
termnote-2.0.1 lib/termnote/loader.rb
termnote-2.0.0 lib/termnote/loader.rb