Class: SourceRoute::Config

Inherits:
Object show all
Defined in:
lib/source_route/config.rb

Overview

todo: Here is not good. Tried to compatible with different options but code becomes hard to maintenance

Constant Summary collapse

DIRECT_ATTRS =
[:event, :full_feature, :debug,
 :output_format, :show_additional_attrs,
 :filename, :include_local_var, :include_instance_var,
 :import_return_to_call, :track_params
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



18
19
20
21
22
23
# File 'lib/source_route/config.rb', line 18

def initialize
  @event = [:call]
  @output_format = :test
  @positives = {}
  @negatives = {}
end

Instance Attribute Details

#negativesObject

Returns the value of attribute negatives.



16
17
18
# File 'lib/source_route/config.rb', line 16

def negatives
  @negatives
end

#positivesObject

Returns the value of attribute positives.



16
17
18
# File 'lib/source_route/config.rb', line 16

def positives
  @positives
end

Instance Method Details

#event_becomes_arrayObject



36
37
38
# File 'lib/source_route/config.rb', line 36

def event_becomes_array
  self.event = Array(event).map(&:to_sym)
end

#formulizeObject

mutable method



26
27
28
29
30
# File 'lib/source_route/config.rb', line 26

def formulize
  symbolize_output_format
  event_becomes_array
  self
end

#has_call_and_return_eventObject



40
41
42
# File 'lib/source_route/config.rb', line 40

def has_call_and_return_event
  event.include? :return and event.include? :call
end

#symbolize_output_formatObject



32
33
34
# File 'lib/source_route/config.rb', line 32

def symbolize_output_format
  self.output_format = output_format.to_sym if output_format.respond_to? :to_sym
end