Module: Tdc::WithIndifferentAccessDecorator
- Defined in:
- lib/tdc/with_indifferent_access_decorator.rb
Overview
Knows how to transform the result of calling the TestDefinitionReader#read method from an Array of Hash instances into an Array of ActiveSupport::HashWithIndifferentAccess instances.
Instance Method Summary collapse
Instance Method Details
#read(*path_elements) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/tdc/with_indifferent_access_decorator.rb', line 7 def read(*path_elements) definitions = super raise Tdc::FatalError, "Use 'with_indifferent_access' only for an Array" unless definitions.is_a?(Array) definitions.map do |definition| definition.is_a?(Hash) ? ActiveSupport::HashWithIndifferentAccess.new(definition) : definition end end |