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 = TpResult::Config.new) ⇒ Condition

Returns a new instance of Condition.



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

def initialize(e=[:call], n={}, p={}, r=TpResult::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



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

def events
  @events
end

#negativesObject

Returns the value of attribute negatives

Returns:

  • (Object)

    the current value of negatives



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

def negatives
  @negatives
end

#positiveObject

Returns the value of attribute positive

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Object)

    the current value of result_config



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

def result_config
  @result_config
end

Instance Method Details

#event(*v) ⇒ Object



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

def event(*v)
  # why need self? without self, the events will not really changed, why?. seems a bug in Struct
  self.events = v.map(&:to_sym) unless v == []
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

#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