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 ⇒ Float
Gets the duration of the session, in seconds.
-
#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
60 61 62 63 |
# File 'lib/castle/log/session.rb', line 60 def current # FIXME current values seem pretty funky... @current ||= float_fields 'Current' end |
#current? ⇒ Boolean
56 57 58 |
# File 'lib/castle/log/session.rb', line 56 def current? present? 'Current' end |
#duration ⇒ Float
Gets the duration of the session, in seconds.
20 21 22 |
# File 'lib/castle/log/session.rb', line 20 def duration @duration ||= tick * @data.values[0].length end |
#power_out ⇒ Object
36 37 38 |
# File 'lib/castle/log/session.rb', line 36 def power_out @power_out ||= float_fields 'Power-Out' end |
#power_out? ⇒ Boolean
32 33 34 |
# File 'lib/castle/log/session.rb', line 32 def power_out? present? 'Power-Out' end |
#ripple ⇒ Object
52 53 54 |
# File 'lib/castle/log/session.rb', line 52 def ripple @ripple ||= float_fields 'Ripple' end |
#ripple? ⇒ Boolean
48 49 50 |
# File 'lib/castle/log/session.rb', line 48 def ripple? present? 'Ripple' end |
#speed ⇒ Object
77 78 79 80 |
# File 'lib/castle/log/session.rb', line 77 def speed # FIXME need a pole count or something here @speed ||= int_fields 'Speed' end |
#speed? ⇒ Boolean
73 74 75 |
# File 'lib/castle/log/session.rb', line 73 def speed? present? 'Speed' end |
#temperature ⇒ Object
69 70 71 |
# File 'lib/castle/log/session.rb', line 69 def temperature @temperature ||= float_fields 'Temperature' end |
#temperature? ⇒ Boolean
65 66 67 |
# File 'lib/castle/log/session.rb', line 65 def temperature? present? 'Temperature' end |
#throttle ⇒ Object
28 29 30 |
# File 'lib/castle/log/session.rb', line 28 def throttle @throttle ||= float_fields 'Throttle' end |
#throttle? ⇒ Boolean
24 25 26 |
# File 'lib/castle/log/session.rb', line 24 def throttle? present? 'Throttle' end |
#voltage ⇒ Object
44 45 46 |
# File 'lib/castle/log/session.rb', line 44 def voltage @voltage ||= float_fields 'Voltage' end |
#voltage? ⇒ Boolean
40 41 42 |
# File 'lib/castle/log/session.rb', line 40 def voltage? present? 'Voltage' end |