Class: Castle::Log::Session
- Inherits:
-
Object
- Object
- Castle::Log::Session
- Defined in:
- lib/castle/log/session.rb
Overview
Represents a single session from a Castle data logger file.
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#tick ⇒ Object
readonly
Returns the value of attribute tick.
Instance Method Summary collapse
- #current ⇒ Object
- #current? ⇒ Boolean
- #duration ⇒ Object
-
#initialize(tick, source, data) ⇒ Session
constructor
A new instance of Session.
- #power_out ⇒ Object
- #power_out? ⇒ Boolean
- #ripple ⇒ Object
- #ripple? ⇒ Boolean
- #speed ⇒ Object
- #speed? ⇒ Boolean
- #temperature ⇒ Object
- #temperature? ⇒ Boolean
- #throttle ⇒ Object
- #throttle? ⇒ Boolean
- #voltage ⇒ Object
- #voltage? ⇒ Boolean
Constructor Details
#initialize(tick, source, data) ⇒ Session
Returns a new instance of Session.
11 12 13 14 15 |
# File 'lib/castle/log/session.rb', line 11 def initialize tick, source, data @tick = tick @source = source @data = data end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
9 10 11 |
# File 'lib/castle/log/session.rb', line 9 def source @source end |
#tick ⇒ Object (readonly)
Returns the value of attribute tick.
7 8 9 |
# File 'lib/castle/log/session.rb', line 7 def tick @tick end |
Instance Method Details
#current ⇒ Object
57 58 59 60 |
# File 'lib/castle/log/session.rb', line 57 def current # FIXME current values seem pretty funky... @current ||= float_fields 'Current' end |
#current? ⇒ Boolean
53 54 55 |
# File 'lib/castle/log/session.rb', line 53 def current? present? 'Current' end |
#duration ⇒ Object
17 18 19 |
# File 'lib/castle/log/session.rb', line 17 def duration @duration ||= tick * @data.values[0].length end |
#power_out ⇒ Object
33 34 35 |
# File 'lib/castle/log/session.rb', line 33 def power_out @power_out ||= float_fields 'Power-Out' end |
#power_out? ⇒ Boolean
29 30 31 |
# File 'lib/castle/log/session.rb', line 29 def power_out? present? 'Power-Out' end |
#ripple ⇒ Object
49 50 51 |
# File 'lib/castle/log/session.rb', line 49 def ripple @ripple ||= float_fields 'Ripple' end |
#ripple? ⇒ Boolean
45 46 47 |
# File 'lib/castle/log/session.rb', line 45 def ripple? present? 'Ripple' end |
#speed ⇒ Object
74 75 76 77 |
# File 'lib/castle/log/session.rb', line 74 def speed # FIXME need a pole count or something here @speed ||= int_fields 'Speed' end |
#speed? ⇒ Boolean
70 71 72 |
# File 'lib/castle/log/session.rb', line 70 def speed? present? 'Speed' end |
#temperature ⇒ Object
66 67 68 |
# File 'lib/castle/log/session.rb', line 66 def temperature @temperature ||= float_fields 'Temperature' end |
#temperature? ⇒ Boolean
62 63 64 |
# File 'lib/castle/log/session.rb', line 62 def temperature? present? 'Temperature' end |
#throttle ⇒ Object
25 26 27 |
# File 'lib/castle/log/session.rb', line 25 def throttle @throttle ||= float_fields 'Throttle' end |
#throttle? ⇒ Boolean
21 22 23 |
# File 'lib/castle/log/session.rb', line 21 def throttle? present? 'Throttle' end |
#voltage ⇒ Object
41 42 43 |
# File 'lib/castle/log/session.rb', line 41 def voltage @voltage ||= float_fields 'Voltage' end |
#voltage? ⇒ Boolean
37 38 39 |
# File 'lib/castle/log/session.rb', line 37 def voltage? present? 'Voltage' end |