Class: Mongoid::History::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/history/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trackable, opts = {}) ⇒ Options

Returns a new instance of Options.



6
7
8
9
# File 'lib/mongoid/history/options.rb', line 6

def initialize(trackable, opts = {})
  @trackable = trackable
  @options = default_options.merge(opts)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/mongoid/history/options.rb', line 4

def options
  @options
end

#trackableObject (readonly)

Returns the value of attribute trackable.



4
5
6
# File 'lib/mongoid/history/options.rb', line 4

def trackable
  @trackable
end

Instance Method Details

#preparedObject



15
16
17
18
19
20
21
22
# File 'lib/mongoid/history/options.rb', line 15

def prepared
  return @prepared if @prepared
  @prepared = options.dup
  prepare_skipped_fields
  prepare_formatted_fields
  parse_tracked_fields_and_relations
  @prepared
end

#scopeObject



11
12
13
# File 'lib/mongoid/history/options.rb', line 11

def scope
  trackable.collection_name.to_s.singularize.to_sym
end