Sha256: 7522b75d6dc8c8243920261fdb2f484cf35afc42b9c83a2253eaf9413d34a6b9
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
module Namie # The Name! class Name attr_accessor :title, :first, :middle, :last, :suffix def initialize(*args) @title, @first, *@middle, @last, @suffix = Namie::Parser.new(args).args end alias_method :firstname, :first alias_method :middlenames, :middle alias_method :lastname, :last def middle return nil if @middle.reject(&:nil?).empty? @middle.join(' ') end def valid? !first.empty? end def ==(other) fullname == other.fullname end def aka match = [first, middle, last].join.match(/['"](\w*)['"]/) match && match[1] end def fullname to_s end def shortname to_s(:short) end def to_s(fmt = nil) Namie::Formatter.new(self, fmt).to_s end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
namie-0.0.3 | lib/namie/name.rb |