Class: Ppl::Service::Name
- Inherits:
-
Object
- Object
- Ppl::Service::Name
- Defined in:
- lib/ppl/service/name.rb
Instance Method Summary collapse
Instance Method Details
#parse(full_name) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/ppl/service/name.rb', line 3 def parse(full_name) parts = full_name.split " " name = Ppl::Entity::Name.new name.full = full_name name.given = parts.shift unless parts[0].nil? name.family = parts.join(" ") unless parts[0].nil? name end |
#update(name, new_values) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/ppl/service/name.rb', line 12 def update(name, new_values) [:full, :given, :family, :middle, :prefix, :suffix].each do |property_name| if !new_values[property_name].nil? setter = (property_name.to_s + "=").to_sym name.send(setter, new_values[property_name]) end end end |