Class: MultipleMan::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/multiple_man/identity.rb

Direct Known Subclasses

MultipleField, SingleField

Defined Under Namespace

Classes: MultipleField, SingleField

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ Identity

Returns a new instance of Identity.



11
12
13
# File 'lib/multiple_man/identity.rb', line 11

def initialize(record)
  self.record = record
end

Instance Attribute Details

#recordObject

Returns the value of attribute record.



15
16
17
# File 'lib/multiple_man/identity.rb', line 15

def record
  @record
end

Class Method Details

.build(record, options) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/multiple_man/identity.rb', line 3

def self.build(record, options)
  if options[:identifier].present?
    SingleField.new(record, options[:identifier])
  else
    MultipleField.new(record, options[:identify_by])
  end
end