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

Creates the output

Parameters:

  • opts (Hash) (defaults to: {})

    Options to create the Output with

Options Hash (opts):

  • :state (Boolean)

    The initial state of the Output



10
11
12
13
# File 'lib/circuits/terminal/output.rb', line 10

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

Instance Method Details

#getBoolean

Gets the state of the output

Returns:

  • (Boolean)

    The state of the output



17
18
19
# File 'lib/circuits/terminal/output.rb', line 17

def get
  state
end

#set(s) ⇒ Object

Saves the state

Parameters:

  • s (Boolean)

    The next desired state of the output



23
24
25
# File 'lib/circuits/terminal/output.rb', line 23

def set(s)
  @next_state = s
end

#tockObject

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



28
29
30
# File 'lib/circuits/terminal/output.rb', line 28

def tock
  @state = next_state
end