Class: Spree::Address::Name

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/address/name.rb

Overview

Provides a value object to help splitting and joining name fields

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*components) ⇒ Name

Returns a new instance of Name.



10
11
12
13
# File 'app/models/spree/address/name.rb', line 10

def initialize(*components)
  @value = components.join(' ').strip
  initialize_name_components(components)
end

Instance Attribute Details

#first_nameObject (readonly)

Returns the value of attribute first_name.



8
9
10
# File 'app/models/spree/address/name.rb', line 8

def first_name
  @first_name
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



8
9
10
# File 'app/models/spree/address/name.rb', line 8

def last_name
  @last_name
end

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'app/models/spree/address/name.rb', line 8

def value
  @value
end

Instance Method Details

#to_sObject



15
16
17
# File 'app/models/spree/address/name.rb', line 15

def to_s
  @value
end