module SimpleEnum

Base module which gets included in ActiveRecord::Base. See documentation of SimpleEnum::ClassMethods for more details.

Constants

VERSION

The current `SimpleEnum` version.

Public Class Methods

configure() { |self| ... } click to toggle source
# File lib/simple_enum.rb, line 39
def self.configure
  yield(self)
end
register_accessor(key, clazz) click to toggle source

Public: Extension method to register a custom accessor.

key - The Symbol of the accessor key, e.g. `:bitwise` clazz - The Class with the accessor implementation

Returns nothing

# File lib/simple_enum/accessors.rb, line 25
def self.register_accessor(key, clazz)
  Accessors::ACCESSORS[key] = clazz
end
register_generator(name, mod) click to toggle source

Public: Register a generator method and add module as part of SimpleEnum::Attribute. The generator method is called after all default generators have been created, this allows to override/change existing methods.

name - The Symbol with the name of the extension mod - The Module implementing `generate_enum_{name}_extension_for` method

Returns nothing

# File lib/simple_enum/attribute.rb, line 105
def self.register_generator(name, mod)
  Attribute.send :include, mod
  Attribute::EXTENSIONS << name.to_s
end