Sha256: 9777145c2e4cb6dbf561042c836d02a1e08a17f74e158543a13234f11146cf80

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

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

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

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

    def with_indifferent_access
      self.extend(Tdc::WithIndifferentAccessDecorator) # rubocop:disable Style/RedundantSelf
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tdc-0.1.2 lib/tdc/in_memory_data_definition.rb