Sha256: ecf51383931ff8f667365961eefec0754e50ced5d6fd2921c8fea966582936ed

Contents?: true

Size: 514 Bytes

Versions: 23

Compression:

Stored size: 514 Bytes

Contents

module Tdc
  #
  # Knows how to read data definitions from an in-memory representation.
  #
  class InMemoryDataDefinition < Tdc::DataDefinition
    def initialize(path_elements_data = {})
      @store = path_elements_data
    end

    def read(*path_elements)
      @store.fetch(path_elements) do
        raise Tdc::FatalError, "The path did not have any data associated with it: #{path_elements.inspect}"
      end
    end

    def store(path_elements, data)
      @store[path_elements] = data
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
tdc-1.1 lib/tdc/in_memory_data_definition.rb
tdc-1.0 lib/tdc/in_memory_data_definition.rb
tdc-0.6.2 lib/tdc/in_memory_data_definition.rb
tdc-0.6.1 lib/tdc/in_memory_data_definition.rb
tdc-0.6.0 lib/tdc/in_memory_data_definition.rb
tdc-0.5.0 lib/tdc/in_memory_data_definition.rb
tdc-0.4.7 lib/tdc/in_memory_data_definition.rb
tdc-0.4.6.1 lib/tdc/in_memory_data_definition.rb
tdc-0.4.6 lib/tdc/in_memory_data_definition.rb
tdc-0.4.4.1 lib/tdc/in_memory_data_definition.rb
tdc-0.4.4 lib/tdc/in_memory_data_definition.rb
tdc-0.3.6 lib/tdc/in_memory_data_definition.rb
tdc-0.3.5 lib/tdc/in_memory_data_definition.rb
tdc-0.3.4 lib/tdc/in_memory_data_definition.rb
tdc-0.3.3 lib/tdc/in_memory_data_definition.rb
tdc-0.3.2 lib/tdc/in_memory_data_definition.rb
tdc-0.3.1 lib/tdc/in_memory_data_definition.rb
tdc-0.3.0 lib/tdc/in_memory_data_definition.rb
tdc-0.2.4 lib/tdc/in_memory_data_definition.rb
tdc-0.2.3 lib/tdc/in_memory_data_definition.rb