class Nomen

Constants

FRAGMENTS
VERSION

Public Class Methods

new(opts={}) click to toggle source
# File lib/nomen.rb, line 5
def initialize(opts={})
  name_opts = opts.select{|k,v| FRAGMENTS.include?(k)}
  name_opts.each{|k,v| send("#{k}=".to_sym, v)}
  self
end

Public Instance Methods

==(other) click to toggle source
# File lib/nomen.rb, line 19
def ==(other)
  FRAGMENTS.each{|m| return false if self.send(m) != other.send(m)}
  true
end
format(type=:full) click to toggle source
# File lib/nomen.rb, line 11
def format(type=:full)
  Nomen::Formatters.lookup(type).format(self)
end
to_h() click to toggle source
# File lib/nomen.rb, line 15
def to_h
  FRAGMENTS.reduce({}){|a,f| a[f] = send(f); a}
end