Class: DataMapper::Resource::VeneerInterface::Property

Inherits:
Veneer::Base::Property show all
Defined in:
lib/veneer/adapters/datamapper/property.rb

Instance Attribute Summary

Attributes inherited from Veneer::Base::Property

#parent

Instance Method Summary collapse

Methods inherited from Veneer::Base::Property

#initialize, #validators

Constructor Details

This class inherits a constructor from Veneer::Base::Property

Instance Method Details

#normalize(type) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/veneer/adapters/datamapper/property.rb', line 5

def normalize(type)
  # Several DataMapper properties' types inherit from the Object class
  # so DataMapper::Property::Object must be the last one i the case statement.
  case type
  when DataMapper::Property::Integer then Integer
  when DataMapper::Property::String then String
  when DataMapper::Property::Float then Float
  when DataMapper::Property::Decimal then BigDecimal
  when DataMapper::Property::DateTime then DateTime
  when DataMapper::Property::Time then Time
  when DataMapper::Property::Date then Date
  when DataMapper::Property::Boolean then TrueClass
  when DataMapper::Property::Discriminator then Class
  when DataMapper::Property::Object then Object
  else type
  end
end