Class: Rabarber::Configuration
- Inherits:
-
Object
- Object
- Rabarber::Configuration
- Includes:
- Singleton
- Defined in:
- lib/rabarber/configuration.rb
Instance Attribute Summary collapse
-
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
-
#current_user_method ⇒ Object
Returns the value of attribute current_user_method.
-
#user_model_name ⇒ Object
Returns the value of attribute user_model_name.
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reset_to_defaults! ⇒ Object
- #user_model ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 |
# File 'lib/rabarber/configuration.rb', line 11 def initialize reset_to_defaults! end |
Instance Attribute Details
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
9 10 11 |
# File 'lib/rabarber/configuration.rb', line 9 def cache_enabled @cache_enabled end |
#current_user_method ⇒ Object
Returns the value of attribute current_user_method.
9 10 11 |
# File 'lib/rabarber/configuration.rb', line 9 def current_user_method @current_user_method end |
#user_model_name ⇒ Object
Returns the value of attribute user_model_name.
9 10 11 |
# File 'lib/rabarber/configuration.rb', line 9 def user_model_name @user_model_name end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
53 54 55 |
# File 'lib/rabarber/configuration.rb', line 53 def configure yield self end |
#reset_to_defaults! ⇒ Object
39 40 41 42 43 |
# File 'lib/rabarber/configuration.rb', line 39 def reset_to_defaults! self.cache_enabled = true self.current_user_method = :current_user self.user_model_name = "User" end |
#user_model ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/rabarber/configuration.rb', line 45 def user_model Rabarber::Inputs::Model.new( user_model_name, error: Rabarber::ConfigurationError, message: "Invalid configuration `user_model_name`, expected an ActiveRecord model name, got #{user_model_name.inspect}" ).process end |