Module: Wrest::Components::Container::Typecaster::InstanceMethods

Defined in:
lib/wrest/components/container/typecaster.rb

Overview

:nodoc:

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_with_typecasting(attributes = {})

:nodoc:



117
118
119
120
121
122
123
# File 'lib/wrest/components/container/typecaster.rb', line 117

def initialize_with_typecasting(attributes = {}) # :nodoc:
  initialize_without_typecasting(attributes)
  self.class.typecast_map.each do |key, typecaster|
    value = @attributes[key]
    @attributes[key] = typecaster.call(value) if (value.is_a?(String) || value.is_a?(Hash) || value.is_a?(Array))
  end
end