Class: MultiMovingsign::Sign

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

Overview

Represents an individual Movingsign LED sign being driven

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Sign

Returns a new instance of Sign.



9
10
11
# File 'lib/multi_movingsign/sign.rb', line 9

def initialize(path)
  self.path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/multi_movingsign/sign.rb', line 7

def path
  @path
end

Class Method Details

.load(hash) ⇒ Object



13
14
15
16
17
# File 'lib/multi_movingsign/sign.rb', line 13

def self.load(hash)
  path = hash['path'] || (raise InvalidInputError, "path key not specified")

  self.new path
end

Instance Method Details

#set_sound(on) ⇒ Object



23
24
25
# File 'lib/multi_movingsign/sign.rb', line 23

def set_sound(on)
  sign.set_sound on
end

#show_text(text, options = {}) ⇒ Object



19
20
21
# File 'lib/multi_movingsign/sign.rb', line 19

def show_text(text, options = {})
  sign.show_text text, options
end

#to_hashObject



27
28
29
# File 'lib/multi_movingsign/sign.rb', line 27

def to_hash
  {'path' => self.path}
end