Class: Opera::Operation::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/opera/operation/config.rb

Constant Summary collapse

DEVELOPMENT_MODE =
:development
PRODUCTION_MODE =
:production

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/opera/operation/config.rb', line 12

def initialize
  @transaction_class = self.class.transaction_class
  @transaction_method = self.class.transaction_method || :transaction
  @transaction_options = self.class.transaction_options

  @instrumentation_class = self.class.instrumentation_class

  @mode = self.class.mode || DEVELOPMENT_MODE
  @reporter = custom_reporter || self.class.reporter

  validate!
end

Class Attribute Details

.instrumentation_classObject

Returns the value of attribute instrumentation_class.



42
43
44
# File 'lib/opera/operation/config.rb', line 42

def instrumentation_class
  @instrumentation_class
end

.modeObject

Returns the value of attribute mode.



42
43
44
# File 'lib/opera/operation/config.rb', line 42

def mode
  @mode
end

.reporterObject

Returns the value of attribute reporter.



42
43
44
# File 'lib/opera/operation/config.rb', line 42

def reporter
  @reporter
end

.transaction_classObject

Returns the value of attribute transaction_class.



42
43
44
# File 'lib/opera/operation/config.rb', line 42

def transaction_class
  @transaction_class
end

.transaction_methodObject

Returns the value of attribute transaction_method.



42
43
44
# File 'lib/opera/operation/config.rb', line 42

def transaction_method
  @transaction_method
end

.transaction_optionsObject

Returns the value of attribute transaction_options.



42
43
44
# File 'lib/opera/operation/config.rb', line 42

def transaction_options
  @transaction_options
end

Instance Attribute Details

#instrumentation_classObject

Returns the value of attribute instrumentation_class.



9
10
11
# File 'lib/opera/operation/config.rb', line 9

def instrumentation_class
  @instrumentation_class
end

#modeObject

Returns the value of attribute mode.



9
10
11
# File 'lib/opera/operation/config.rb', line 9

def mode
  @mode
end

#reporterObject

Returns the value of attribute reporter.



9
10
11
# File 'lib/opera/operation/config.rb', line 9

def reporter
  @reporter
end

#transaction_classObject

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_methodObject

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_optionsObject

Returns the value of attribute transaction_options.



9
10
11
# File 'lib/opera/operation/config.rb', line 9

def transaction_options
  @transaction_options
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



45
46
47
# File 'lib/opera/operation/config.rb', line 45

def configure
  yield self
end

.development_mode?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/opera/operation/config.rb', line 49

def development_mode?
  mode == DEFAULT_MODE
end

.production_mode?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/opera/operation/config.rb', line 53

def production_mode?
  mode == PRODUCTION_MODE
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



25
26
27
# File 'lib/opera/operation/config.rb', line 25

def configure
  yield self
end

#custom_reporterObject



29
30
31
# File 'lib/opera/operation/config.rb', line 29

def custom_reporter
  Rails.application.config.x.reporter.presence if defined?(Rails)
end