Class: FactoryTrace::Configuration
- Inherits:
-
Object
- Object
- FactoryTrace::Configuration
- Defined in:
- lib/factory_trace/configuration.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#path ⇒ Object
Returns the value of attribute path.
-
#trace_definition ⇒ Object
Returns the value of attribute trace_definition.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #mode?(*args) ⇒ Boolean
- #out ⇒ Object
- #trace_definition? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 |
# File 'lib/factory_trace/configuration.rb', line 7 def initialize @enabled = ENV.key?("FB_TRACE") || ENV.key?("FB_TRACE_FILE") @path = ENV["FB_TRACE_FILE"] @color = path.nil? @mode = extract_mode(ENV["FB_TRACE"]) || :full @trace_definition = true end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
5 6 7 |
# File 'lib/factory_trace/configuration.rb', line 5 def color @color end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/factory_trace/configuration.rb', line 5 def enabled @enabled end |
#mode ⇒ Object
Returns the value of attribute mode.
5 6 7 |
# File 'lib/factory_trace/configuration.rb', line 5 def mode @mode end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/factory_trace/configuration.rb', line 5 def path @path end |
#trace_definition ⇒ Object
Returns the value of attribute trace_definition.
5 6 7 |
# File 'lib/factory_trace/configuration.rb', line 5 def trace_definition @trace_definition end |
Instance Method Details
#mode?(*args) ⇒ Boolean
25 26 27 |
# File 'lib/factory_trace/configuration.rb', line 25 def mode?(*args) args.include?(mode) end |
#out ⇒ Object
19 20 21 22 23 |
# File 'lib/factory_trace/configuration.rb', line 19 def out return $stdout unless path File.open(path, "w") end |
#trace_definition? ⇒ Boolean
15 16 17 |
# File 'lib/factory_trace/configuration.rb', line 15 def trace_definition? @trace_definition end |