Module: Enumerize

Defined in:
lib/enumerize.rb,
lib/enumerize/set.rb,
lib/enumerize/base.rb,
lib/enumerize/utils.rb,
lib/enumerize/value.rb,
lib/enumerize/module.rb,
lib/enumerize/sequel.rb,
lib/enumerize/mongoid.rb,
lib/enumerize/version.rb,
lib/enumerize/attribute.rb,
lib/enumerize/predicates.rb,
lib/enumerize/activemodel.rb,
lib/enumerize/activerecord.rb,
lib/enumerize/predicatable.rb,
lib/enumerize/scope/sequel.rb,
lib/enumerize/attribute_map.rb,
lib/enumerize/scope/mongoid.rb,
lib/enumerize/hooks/formtastic.rb,
lib/enumerize/hooks/uniqueness.rb,
lib/enumerize/hooks/simple_form.rb,
lib/enumerize/module_attributes.rb,
lib/enumerize/integrations/rspec.rb,
lib/enumerize/scope/activerecord.rb,
lib/enumerize/hooks/sequel_dataset.rb,
lib/enumerize/integrations/rails_admin.rb,
lib/enumerize/integrations/rspec/matcher.rb

Defined Under Namespace

Modules: ActiveModelAttributesSupport, ActiveRecordSupport, Base, Hooks, Integrations, ModuleAttributes, MongoidSupport, Multiple, Predicatable, Predicates, Scope, SequelSupport, Utils Classes: Attribute, AttributeMap, Module, Set, Value

Constant Summary collapse

VERSION =
'2.4.0'

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/enumerize.rb', line 35

def self.extended(base)
  base.send :include, Enumerize::Base
  base.extend Enumerize::Predicates

  if defined?(::ActiveModel::Attributes)
    base.extend Enumerize::ActiveModelAttributesSupport
  end

  if defined?(::ActiveRecord::Base)
    base.extend Enumerize::ActiveRecordSupport
    base.extend Enumerize::Scope::ActiveRecord
  end

  if defined?(::Mongoid::Document)
    base.extend Enumerize::MongoidSupport
    base.extend Enumerize::Scope::Mongoid
  end

  if defined?(::Sequel::Model)
    base.extend Enumerize::SequelSupport
    base.extend Enumerize::Scope::Sequel
  end

  if defined?(::RailsAdmin)
    require 'enumerize/integrations/rails_admin'
    base.extend Enumerize::Integrations::RailsAdmin
  end

  if ::Module === base
    base.extend Enumerize::Base::ClassMethods
    base.extend Enumerize::ModuleAttributes
  end

  super
end

.included(base) ⇒ Object


30
31
32
33
# File 'lib/enumerize.rb', line 30

def self.included(base)
  ActiveSupport::Deprecation.warn '`include Enumerize` was deprecated. Please use `extend Enumerize`.', caller
  extended(base)
end