Module: Humanized::HasNaturalGenus

Defined in:
lib/humanized.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



50
51
52
53
54
# File 'lib/humanized.rb', line 50

def self.included(base)
  base.class_eval do
    alias_method_chain :humanization_key, :genus
  end
end

Instance Method Details

#genusObject

Raises:

  • (NoMethodError)


56
57
58
59
# File 'lib/humanized.rb', line 56

def genus
  return super if defined? super
  raise NoMethodError, "Please implent a method `genus`!"
end

#humanization_key_with_genusObject



61
62
63
# File 'lib/humanized.rb', line 61

def humanization_key_with_genus
  return humanization_key_without_genus.optionally(self.genus)
end