Class: DataMapper::TypeMap::TypeChain

  • Object
    • DataMapper::TypeMap::TypeChain

Attributes

Instance Attributes

attributes [RW] public

Sets the attribute attributes.

primitive [RW] public

Sets the attribute primitive.

Constructor Summary

public initialize
[View source]


52
53
54
55
56
57
# File 'dm-core/lib/dm-core/type_map.rb', line 52

def initialize



  @attributes = {}
end

Public Visibility

Public Instance Method Summary

#to(primitive)
#translate
#with(attributes)

Public Instance Methods Inherited from Object

validatable?

Public Instance Method Details

to

public to(primitive)
[View source]


56
57
58
59
# File 'dm-core/lib/dm-core/type_map.rb', line 56

def to(primitive)
  @primitive = primitive
  self
end

translate

public translate
[View source]


67
68
69
70
71
72
# File 'dm-core/lib/dm-core/type_map.rb', line 67

def translate



  @attributes.merge((@primitive.nil? ? {} : {:primitive => @primitive}))
end

with

public with(attributes)
[View source]


61
62
63
64
65
# File 'dm-core/lib/dm-core/type_map.rb', line 61

def with(attributes)
  raise "method 'with' expects a hash" unless Hash === attributes
  @attributes.merge!(attributes)
  self
end