Class: Circuits::Terminal::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/circuits/terminal/output.rb

Overview

Belongs to a single component, gets set for reading by inputs

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Output

Returns a new instance of Output.



7
8
9
10
# File 'lib/circuits/terminal/output.rb', line 7

def initialize(opts = {})
  @next_state = opts[:state] || false
  @state = opts[:state] || false
end

Instance Method Details

#getTrueClass, FalseClass

Gets the state of the output

Returns:

  • (TrueClass, FalseClass)

    The state of the output



14
15
16
# File 'lib/circuits/terminal/output.rb', line 14

def get
  state
end

#set(s) ⇒ Object

Saves the state

Parameters:

  • The (TrueClass, FalseClass)

    next desired state of the output



20
21
22
# File 'lib/circuits/terminal/output.rb', line 20

def set(s)
  @next_state = s
end

#tockObject

Sets the state to be the last state passed by #set



25
26
27
# File 'lib/circuits/terminal/output.rb', line 25

def tock
  @state = next_state
end