Class: FactoryTrace::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_trace/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#colorObject

Returns the value of attribute color.



5
6
7
# File 'lib/factory_trace/configuration.rb', line 5

def color
  @color
end

#enabledObject

Returns the value of attribute enabled.



5
6
7
# File 'lib/factory_trace/configuration.rb', line 5

def enabled
  @enabled
end

#modeObject

Returns the value of attribute mode.



5
6
7
# File 'lib/factory_trace/configuration.rb', line 5

def mode
  @mode
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/factory_trace/configuration.rb', line 5

def path
  @path
end

#trace_definitionObject

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

Returns:

  • (Boolean)


25
26
27
# File 'lib/factory_trace/configuration.rb', line 25

def mode?(*args)
  args.include?(mode)
end

#outObject



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

Returns:

  • (Boolean)


15
16
17
# File 'lib/factory_trace/configuration.rb', line 15

def trace_definition?
  @trace_definition
end