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

Returns a new instance of Condition.



15
16
17
# File 'lib/source_route/wrapper.rb', line 15

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

Instance Attribute Details

#eventsObject

Returns the value of attribute events

Returns:

  • (Object)

    the current value of events



14
15
16
# File 'lib/source_route/wrapper.rb', line 14

def events
  @events
end

#negativesObject

Returns the value of attribute negatives

Returns:

  • (Object)

    the current value of negatives



14
15
16
# File 'lib/source_route/wrapper.rb', line 14

def negatives
  @negatives
end

#positiveObject

Returns the value of attribute positive

Returns:

  • (Object)

    the current value of positive



14
15
16
# File 'lib/source_route/wrapper.rb', line 14

def positive
  @positive
end

#result_configObject

Returns the value of attribute result_config

Returns:

  • (Object)

    the current value of result_config



14
15
16
# File 'lib/source_route/wrapper.rb', line 14

def result_config
  @result_config
end

Instance Method Details

#debug(value = false) ⇒ Object



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

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

#event(*v) ⇒ Object



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

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

#full_feature(value = true) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/source_route/wrapper.rb', line 44

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



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

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

#is_debug?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/source_route/wrapper.rb', line 64

def is_debug?
  @debug
end

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



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

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