module NaturalBornSlugger::ClassMethods
Public Instance Methods
has_composite_attribute(name, options={})
click to toggle source
Adds a generic composite attribute to the class. Name is required.
# File lib/natural_born_slugger/class_methods.rb, line 27 def has_composite_attribute(name, options={}) NaturalBornSlugger::AttributeComposer.new(name, options).add_to(self) end
has_natural_key(name, options={})
click to toggle source
Adds a natural key to the class. Name is optional.
# File lib/natural_born_slugger/class_methods.rb, line 18 def has_natural_key(name, options={}) # Use default name if not provided name, options = 'natural_key', name if name.is_a?(Hash) NaturalBornSlugger::AttributeComposer.new(name, options).add_to(self) end
has_slug(name, options={})
click to toggle source
Adds a slug to the class. Name is optional.
# File lib/natural_born_slugger/class_methods.rb, line 9 def has_slug(name, options={}) # Use default name if not provided name, options = 'slug', name if name.is_a?(Hash) NaturalBornSlugger::AttributeComposer.new(name, options).add_to(self) end