Class: Mongoid::Orderable::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/orderable/installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, options = {}) ⇒ Installer

Returns a new instance of Installer.



8
9
10
11
# File 'lib/mongoid/orderable/installer.rb', line 8

def initialize(klass, options = {})
  @klass = klass
  @config = Mongoid::Orderable::Configs::FieldConfig.new(klass, options).options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/mongoid/orderable/installer.rb', line 6

def config
  @config
end

#klassObject (readonly)

Returns the value of attribute klass.



6
7
8
# File 'lib/mongoid/orderable/installer.rb', line 6

def klass
  @klass
end

Instance Method Details

#setupObject



13
14
15
16
17
18
19
# File 'lib/mongoid/orderable/installer.rb', line 13

def setup
  add_db_field
  add_db_index if config[:index]
  save_config
  include_mixins
  generate_all_helpers
end