Class: Subduino::Parse::Digital
- Inherits:
-
Object
- Object
- Subduino::Parse::Digital
- Defined in:
- lib/subduino/parse.rb
Instance Method Summary collapse
- #digital? ⇒ Boolean
- #graph(period) ⇒ Object
-
#initialize(v, n = nil, id = nil) ⇒ Digital
constructor
A new instance of Digital.
- #name ⇒ Object
- #raw ⇒ Object
- #sparkline(range = [-50, -1]) ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(v, n = nil, id = nil) ⇒ Digital
Returns a new instance of Digital.
10 11 12 13 14 |
# File 'lib/subduino/parse.rb', line 10 def initialize(v,n=nil,id=nil) @v = v.to_i @id = id @name = n end |
Instance Method Details
#digital? ⇒ Boolean
15 |
# File 'lib/subduino/parse.rb', line 15 def digital?; true; end |
#graph(period) ⇒ Object
27 28 29 |
# File 'lib/subduino/parse.rb', line 27 def graph(period) Store.redis end |
#name ⇒ Object
17 |
# File 'lib/subduino/parse.rb', line 17 def name; @name; end |
#raw ⇒ Object
21 |
# File 'lib/subduino/parse.rb', line 21 def raw; @v; end |
#sparkline(range = [-50, -1]) ⇒ Object
23 24 25 |
# File 'lib/subduino/parse.rb', line 23 def sparkline(range = [-50, -1]) Store.redis.lrange "#{@id}_log", *range end |
#to_s ⇒ Object
16 |
# File 'lib/subduino/parse.rb', line 16 def to_s; @v.to_s; end |
#type ⇒ Object
18 19 20 |
# File 'lib/subduino/parse.rb', line 18 def type self.class.to_s.split("::")[-1].downcase # ugly end |