module Tdc::WithIndifferentAccessDecorator

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.

Public Instance Methods

read(*path_elements) click to toggle source
Calls superclass method
# 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