Class: Mongoid::Userstamp::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/userstamp/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Config

Returns a new instance of Config.



9
10
11
12
# File 'lib/mongoid/userstamp/config.rb', line 9

def initialize(&block)
  reset!
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#creator_fieldObject

Returns the value of attribute creator_field.



6
7
8
# File 'lib/mongoid/userstamp/config.rb', line 6

def creator_field
  @creator_field
end

#updater_fieldObject

Returns the value of attribute updater_field.



7
8
9
# File 'lib/mongoid/userstamp/config.rb', line 7

def updater_field
  @updater_field
end

#user_modelObject



25
26
27
# File 'lib/mongoid/userstamp/config.rb', line 25

def user_model
  @user_model.to_s.classify.constantize
end

#user_readerObject

Returns the value of attribute user_reader.



5
6
7
# File 'lib/mongoid/userstamp/config.rb', line 5

def user_reader
  @user_reader
end

Instance Method Details

#reset!Object



14
15
16
17
18
19
# File 'lib/mongoid/userstamp/config.rb', line 14

def reset!
  @user_model = :user
  @user_reader = :current_user
  @creator_field = :creator
  @updater_field = :updater
end

#user_model_nameObject



21
22
23
# File 'lib/mongoid/userstamp/config.rb', line 21

def user_model_name
  @user_model.to_s.classify
end