Class: Amberletters::Trigger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ Trigger

Returns a new instance of Trigger.



66
67
68
69
70
71
72
# File 'lib/amberletters.rb', line 66

def initialize(options={}, &block)
  @block        = block || lambda{|*|}
  @exclusive    = options.fetch(:exclusive) { false }
  @logger       = ::Logger.new($stdout)
  @interruption = :none
  @options      = options
end

Instance Attribute Details

#exclusiveObject Also known as: exclusive?

Returns the value of attribute exclusive.



59
60
61
# File 'lib/amberletters.rb', line 59

def exclusive
  @exclusive
end

#interruptionObject

Returns the value of attribute interruption.



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

def interruption
  @interruption
end

#loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



62
63
64
# File 'lib/amberletters.rb', line 62

def options
  @options
end

#time_to_liveObject

Returns the value of attribute time_to_live.



58
59
60
# File 'lib/amberletters.rb', line 58

def time_to_live
  @time_to_live
end

Instance Method Details

#call(process) ⇒ Object



74
75
76
77
# File 'lib/amberletters.rb', line 74

def call(process)
  @block.call(self, process)
  true
end