Class: SourceRoute::Wrapper::Condition

Inherits:
Struct
  • Object
show all
Defined in:
lib/source_route/wrapper.rb,
lib/source_route/wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(e = [:call], n = {}, p = {}, r = GenerateResult::Config.new) ⇒ Condition



11
12
13
14
# File 'lib/source_route/wrapper.rb', line 11

def initialize(e=[:call], n={}, p={}, r=GenerateResult::Config.new)
  @debug = false
  super(e, n, p, r)
end

Instance Attribute Details

#eventsObject

Returns the value of attribute events



10
11
12
# File 'lib/source_route/wrapper.rb', line 10

def events
  @events
end

#negativesObject

Returns the value of attribute negatives



10
11
12
# File 'lib/source_route/wrapper.rb', line 10

def negatives
  @negatives
end

#positiveObject

Returns the value of attribute positive



10
11
12
# File 'lib/source_route/wrapper.rb', line 10

def positive
  @positive
end

#result_configObject

Returns the value of attribute result_config



10
11
12
# File 'lib/source_route/wrapper.rb', line 10

def result_config
  @result_config
end

Instance Method Details

#debug(value = false) ⇒ Object



57
58
59
# File 'lib/source_route/wrapper.rb', line 57

def debug(value=false)
  @debug = value
end

#event(*v) ⇒ Object



29
30
31
# File 'lib/source_route/wrapper.rb', line 29

def event(*v)
  self.events = v.map(&:to_sym) unless v == []
end

#full_feature(value = true) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/source_route/wrapper.rb', line 41

def full_feature(value=true)
  return unless value

  self.events = [:call, :return]
  result_config.import_return_to_call = true

  result_config.show_additional_attrs = [:path, :lineno]
  # JSON serialize trigger many problems when handle complicated object

  # a Back Door to open more data. but be care it could trigger weird crash when Jsonify these vars
  if value == 10
    result_config.include_instance_var = true
    result_config.include_local_var = true
  end
end

#has_call_and_return_eventObject



37
38
39
# File 'lib/source_route/wrapper.rb', line 37

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

#is_debug?Boolean



61
62
63
# File 'lib/source_route/wrapper.rb', line 61

def is_debug?
  @debug
end

#output_format(data = nil, &block) ⇒ Object



33
34
35
# File 'lib/source_route/wrapper.rb', line 33

def output_format(data = nil, &block)
  result_config.format = block_given? ? block : data
end