Module: Resourceful::Model::AttributeTypes::ClassMethods

Defined in:
lib/resourceful/model/attribute_types.rb

Constant Summary collapse

ATTRIBUTE_TYPES =
{
  :string   => { :method => 'to_s',               :kind => ::String   },
  :text     => { :method => 'to_s',               :kind => ::String   },
  :integer  => { :method => 'to_i',               :kind => ::Integer  },
  :float    => { :method => 'to_f',               :kind => ::Float    },
  :currency => { :method => 'from_currency_to_f', :kind => ::Float    },
  :date     => { :method => 'to_date',            :kind => ::Date     },
  :datetime => { :method => 'to_datetime',        :kind => ::DateTime },
  :time     => { :method => 'to_time_at',         :kind => ::Time     },
  :boolean  => { :method => 'to_boolean',         :kind => ::Object   },
  :other    => { :method => 'to_s',               :kind => ::String   }
}

Instance Method Summary collapse

Instance Method Details

#attribute_type_to_kind(type) ⇒ Object



25
26
27
# File 'lib/resourceful/model/attribute_types.rb', line 25

def attribute_type_to_kind(type)
  get_attribute_type_config(type)[:kind]
end

#attribute_type_to_method(type) ⇒ Object



21
22
23
# File 'lib/resourceful/model/attribute_types.rb', line 21

def attribute_type_to_method(type)
  get_attribute_type_config(type)[:method]
end