Class: Opera::Operation::Config
- Inherits:
-
Object
- Object
- Opera::Operation::Config
- Defined in:
- lib/opera/operation/config.rb
Constant Summary collapse
- DEVELOPMENT_MODE =
:development
- PRODUCTION_MODE =
:production
Class Attribute Summary collapse
-
.mode ⇒ Object
Returns the value of attribute mode.
-
.reporter ⇒ Object
Returns the value of attribute reporter.
-
.transaction_class ⇒ Object
Returns the value of attribute transaction_class.
-
.transaction_method ⇒ Object
Returns the value of attribute transaction_method.
-
.transaction_options ⇒ Object
Returns the value of attribute transaction_options.
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
-
#transaction_class ⇒ Object
Returns the value of attribute transaction_class.
-
#transaction_method ⇒ Object
Returns the value of attribute transaction_method.
-
#transaction_options ⇒ Object
Returns the value of attribute transaction_options.
Class Method Summary collapse
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
- #custom_reporter ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 19 |
# File 'lib/opera/operation/config.rb', line 11 def initialize @transaction_class = self.class.transaction_class @transaction_method = self.class.transaction_method || :transaction @transaction_options = self.class. @mode = self.class.mode || DEVELOPMENT_MODE @reporter = custom_reporter || self.class.reporter validate! end |
Class Attribute Details
.mode ⇒ Object
Returns the value of attribute mode.
38 39 40 |
# File 'lib/opera/operation/config.rb', line 38 def mode @mode end |
.reporter ⇒ Object
Returns the value of attribute reporter.
38 39 40 |
# File 'lib/opera/operation/config.rb', line 38 def reporter @reporter end |
.transaction_class ⇒ Object
Returns the value of attribute transaction_class.
38 39 40 |
# File 'lib/opera/operation/config.rb', line 38 def transaction_class @transaction_class end |
.transaction_method ⇒ Object
Returns the value of attribute transaction_method.
38 39 40 |
# File 'lib/opera/operation/config.rb', line 38 def transaction_method @transaction_method end |
.transaction_options ⇒ Object
Returns the value of attribute transaction_options.
38 39 40 |
# File 'lib/opera/operation/config.rb', line 38 def @transaction_options end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
9 10 11 |
# File 'lib/opera/operation/config.rb', line 9 def mode @mode end |
#reporter ⇒ Object
Returns the value of attribute reporter.
9 10 11 |
# File 'lib/opera/operation/config.rb', line 9 def reporter @reporter end |
#transaction_class ⇒ Object
Returns the value of attribute transaction_class.
9 10 11 |
# File 'lib/opera/operation/config.rb', line 9 def transaction_class @transaction_class end |
#transaction_method ⇒ Object
Returns the value of attribute transaction_method.
9 10 11 |
# File 'lib/opera/operation/config.rb', line 9 def transaction_method @transaction_method end |
#transaction_options ⇒ Object
Returns the value of attribute transaction_options.
9 10 11 |
# File 'lib/opera/operation/config.rb', line 9 def @transaction_options end |
Class Method Details
.configure {|_self| ... } ⇒ Object
40 41 42 |
# File 'lib/opera/operation/config.rb', line 40 def configure yield self end |
.development_mode? ⇒ Boolean
44 45 46 |
# File 'lib/opera/operation/config.rb', line 44 def development_mode? mode == DEFAULT_MODE end |
.production_mode? ⇒ Boolean
48 49 50 |
# File 'lib/opera/operation/config.rb', line 48 def production_mode? mode == PRODUCTION_MODE end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
21 22 23 |
# File 'lib/opera/operation/config.rb', line 21 def configure yield self end |
#custom_reporter ⇒ Object
25 26 27 |
# File 'lib/opera/operation/config.rb', line 25 def custom_reporter Rails.application.config.x.reporter.presence if defined?(Rails) end |