class HumanName
Constants
- Defaults
- VERSION
Attributes
first_name[R]
last_name[R]
Public Class Methods
new(first_name, last_name)
click to toggle source
# File lib/human_name.rb, line 7 def initialize(first_name, last_name) @first_name, @last_name = first_name, last_name end
Public Instance Methods
full_name()
click to toggle source
# File lib/human_name.rb, line 19 def full_name non_blank_names.join(' ') end
name_initials()
click to toggle source
# File lib/human_name.rb, line 23 def name_initials non_blank_names.map { |n| "#{n[0]}." }.join(' ') end
Private Instance Methods
non_blank_names()
click to toggle source
# File lib/human_name.rb, line 29 def non_blank_names [first_name, last_name].delete_if(&:empty?) end