Module: Denko::Behaviors::SinglePin

Constant Summary

Constants included from Lifecycle

Lifecycle::CALLBACK_METHODS

Instance Attribute Summary collapse

Attributes included from Component

#board, #params

Attributes included from State

#state

Instance Method Summary collapse

Methods included from Component

#initialize, #micro_delay

Methods included from State

#update_state

Methods included from Lifecycle

included

Instance Attribute Details

#modeObject

Returns the value of attribute mode.



5
6
7
# File 'lib/denko/behaviors/single_pin.rb', line 5

def mode
  @mode
end

#pinObject (readonly)

Returns the value of attribute pin.



5
6
7
# File 'lib/denko/behaviors/single_pin.rb', line 5

def pin
  @pin
end

Instance Method Details

#convert_pins(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
# File 'lib/denko/behaviors/single_pin.rb', line 12

def convert_pins(options={})
  raise ArgumentError, 'a pin is required for this component' unless options[:pin]
  options[:pin] = board.convert_pin(options[:pin])
end

#initialize_pins(options = {}) ⇒ Object



17
18
19
20
# File 'lib/denko/behaviors/single_pin.rb', line 17

def initialize_pins(options={})
  @pin = options[:pin]
  self.mode = params[:mode] if params[:mode]
end