Module: FullName
- Defined in:
- lib/full_name.rb
Constant Summary collapse
- LOCALES =
[:en, :fr]
Instance Method Summary collapse
Instance Method Details
#full_name(locale = :en) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/full_name.rb', line 4 def full_name locale = :en return full_name unless LOCALES.include? locale unless first_name.nil? or first_name.empty? unless last_name.nil? or last_name.empty? build_with_both locale else build_with_firstname end else unless last_name.nil? or last_name.empty? build_with_lastname locale else '' end end end |