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.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #mode?(*args) ⇒ Boolean
- #out ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 10 |
# File 'lib/factory_trace/configuration.rb', line 5 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 end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
3 4 5 |
# File 'lib/factory_trace/configuration.rb', line 3 def color @color end |
#enabled ⇒ Object
Returns the value of attribute enabled.
3 4 5 |
# File 'lib/factory_trace/configuration.rb', line 3 def enabled @enabled end |
#mode ⇒ Object
Returns the value of attribute mode.
3 4 5 |
# File 'lib/factory_trace/configuration.rb', line 3 def mode @mode end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/factory_trace/configuration.rb', line 3 def path @path end |
Instance Method Details
#mode?(*args) ⇒ Boolean
18 19 20 |
# File 'lib/factory_trace/configuration.rb', line 18 def mode?(*args) args.include?(mode) end |
#out ⇒ Object
12 13 14 15 16 |
# File 'lib/factory_trace/configuration.rb', line 12 def out return STDOUT unless path File.open(path, 'w') end |