Class: Protoboard::Circuit

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

Overview

This class represents a circuit.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Circuit

Returns a new instance of Circuit.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/protoboard/circuit.rb', line 12

def initialize(**options)
  @name = options.fetch(:name)
  @service = options.fetch(:service)
  @method_name = options.fetch(:method_name)
  @open_after = options.fetch(:open_after)
  @cool_off_after = options.fetch(:cool_off_after)
  @fallback = options[:fallback]
  @on_before = options.fetch(:on_before, [])
  @on_after = options.fetch(:on_after, [])
  @singleton_method = options.fetch(:singleton_method, false)
rescue KeyError => error
  raise ArgumentError, "Missing required arguments: #{error.message}"
end

Instance Attribute Details

#cool_off_afterObject (readonly)

Returns the value of attribute cool_off_after.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def cool_off_after
  @cool_off_after
end

#fallbackObject (readonly)

Returns the value of attribute fallback.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def fallback
  @fallback
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def method_name
  @method_name
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def name
  @name
end

#on_afterObject (readonly)

Returns the value of attribute on_after.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def on_after
  @on_after
end

#on_beforeObject (readonly)

Returns the value of attribute on_before.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def on_before
  @on_before
end

#open_afterObject (readonly)

Returns the value of attribute open_after.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def open_after
  @open_after
end

#serviceObject (readonly)

Returns the value of attribute service.



7
8
9
# File 'lib/protoboard/circuit.rb', line 7

def service
  @service
end

Instance Method Details

#singleton_method?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/protoboard/circuit.rb', line 26

def singleton_method?
  @singleton_method
end