Class: ROM::Mapper::Attribute

Inherits:
Struct
  • Object
show all
Includes:
Adamantium
Defined in:
lib/rom/mapper/attribute.rb

Overview

Represents a mapping attribute

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fieldObject

Returns the value of attribute field

Returns:

  • (Object)

    the current value of field



9
10
11
# File 'lib/rom/mapper/attribute.rb', line 9

def field
  @field
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



9
10
11
# File 'lib/rom/mapper/attribute.rb', line 9

def name
  @name
end

Class Method Details

.coerce(input, mapping = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
# File 'lib/rom/mapper/attribute.rb', line 13

def self.coerce(input, mapping = nil)
  field = Axiom::Attribute.coerce(input)
  new(mapping || field.name, field)
end

Instance Method Details

#mappingObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/rom/mapper/attribute.rb', line 19

def mapping
  { tuple_key => name }
end

#tuple_keyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/rom/mapper/attribute.rb', line 24

def tuple_key
  field.name
end