Sha256: d0fbb785cbf64bb1fd574c829773bbd5d031228f13e4359f6b5f399bcd379923
Contents?: true
Size: 543 Bytes
Versions: 1
Compression:
Stored size: 543 Bytes
Contents
class Nomen FRAGMENTS = [:first, :middle, :last, :suffix] attr_accessor *FRAGMENTS def initialize(opts={}) name_opts = opts.select{|k,v| FRAGMENTS.include?(k)} name_opts.each{|k,v| send("#{k}=".to_sym, v)} self end def format(type=:full) Nomen::Formatters.lookup(type).format(self) end def to_h FRAGMENTS.reduce({}){|a,f| a[f] = send(f); a} end def ==(other) FRAGMENTS.each{|m| return false if self.send(m) != other.send(m)} true end end require 'nomen/version' require 'nomen/formatters'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nomen-0.0.2 | lib/nomen.rb |