class Juscribe::Name

Attributes

first[R]
last[R]
middle[R]

Public Class Methods

convert(input) click to toggle source
# File lib/juscribe/name.rb, line 6
def convert(input)
  case input
  when String
    new(*input.split(/\s+/))
  end
end
new(first, *others, last) click to toggle source
# File lib/juscribe/name.rb, line 14
def initialize(first, *others, last)
  @first, @middle, @last = first, others.first, last
end

Public Instance Methods

complete() click to toggle source
# File lib/juscribe/name.rb, line 30
def complete
  [first, *middle, *last].join(' ')
end
first_and_last() click to toggle source
# File lib/juscribe/name.rb, line 22
def first_and_last
  [first, *last].join(' ')
end
full() click to toggle source
# File lib/juscribe/name.rb, line 26
def full
  [first, *middle_initial, *last].join(' ')
end
inspect() click to toggle source
# File lib/juscribe/name.rb, line 38
def inspect
  %Q{"#{complete}"}
end
middle_initial() click to toggle source
# File lib/juscribe/name.rb, line 18
def middle_initial
  "#{middle.first}." if middle.present?
end
to_s() click to toggle source
# File lib/juscribe/name.rb, line 34
def to_s
  full
end