Class: Mongoid::Userstamp::Config
- Inherits:
-
Object
- Object
- Mongoid::Userstamp::Config
- Defined in:
- lib/mongoid/userstamp/config.rb
Instance Attribute Summary collapse
-
#creator_field ⇒ Object
Returns the value of attribute creator_field.
-
#updater_field ⇒ Object
Returns the value of attribute updater_field.
- #user_model ⇒ Object
-
#user_reader ⇒ Object
Returns the value of attribute user_reader.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Config
constructor
A new instance of Config.
- #reset! ⇒ Object
- #user_model_name ⇒ Object
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_field ⇒ Object
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_field ⇒ Object
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_model ⇒ Object
25 26 27 |
# File 'lib/mongoid/userstamp/config.rb', line 25 def user_model @user_model.to_s.classify.constantize end |
#user_reader ⇒ Object
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_name ⇒ Object
21 22 23 |
# File 'lib/mongoid/userstamp/config.rb', line 21 def user_model_name @user_model.to_s.classify end |