Class: MilkMaid::BatchRecord
- Inherits:
-
Object
- Object
- MilkMaid::BatchRecord
- Defined in:
- lib/milk_maid/google_sheet_notifier.rb
Instance Attribute Summary collapse
-
#base_temperature ⇒ Object
Returns the value of attribute base_temperature.
-
#batch_size ⇒ Object
Returns the value of attribute batch_size.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#guid ⇒ Object
Returns the value of attribute guid.
-
#name ⇒ Object
Returns the value of attribute name.
-
#record ⇒ Object
Returns the value of attribute record.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #add_event(event_type, data = 0) ⇒ Object
- #complete! ⇒ Object
- #event_name_from_type(event) ⇒ Object
- #events ⇒ Object
-
#initialize(batch_data = {}) ⇒ BatchRecord
constructor
A new instance of BatchRecord.
- #timestamp ⇒ Object
Constructor Details
#initialize(batch_data = {}) ⇒ BatchRecord
Returns a new instance of BatchRecord.
36 37 38 39 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 36 def initialize(batch_data = {}) batch_data.each { |key, value| send("#{key}=", value) } @status = 'Started' end |
Instance Attribute Details
#base_temperature ⇒ Object
Returns the value of attribute base_temperature.
34 35 36 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 34 def base_temperature @base_temperature end |
#batch_size ⇒ Object
Returns the value of attribute batch_size.
34 35 36 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 34 def batch_size @batch_size end |
#duration ⇒ Object
Returns the value of attribute duration.
34 35 36 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 34 def duration @duration end |
#guid ⇒ Object
Returns the value of attribute guid.
34 35 36 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 34 def guid @guid end |
#name ⇒ Object
Returns the value of attribute name.
34 35 36 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 34 def name @name end |
#record ⇒ Object
Returns the value of attribute record.
34 35 36 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 34 def record @record end |
#status ⇒ Object
Returns the value of attribute status.
34 35 36 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 34 def status @status end |
Instance Method Details
#add_event(event_type, data = 0) ⇒ Object
41 42 43 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 41 def add_event(event_type, data = 0) events << ::MilkMaid::Event.new(event_name_from_type(event_type), data, ) end |
#complete! ⇒ Object
45 46 47 48 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 45 def complete! add_event(:batch_completed) @status = 'Completed' end |
#event_name_from_type(event) ⇒ Object
50 51 52 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 50 def event_name_from_type(event) event.to_s.split(/_/).map(&:capitalize).join(' ') end |
#events ⇒ Object
54 55 56 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 54 def events @events ||= [] end |
#timestamp ⇒ Object
58 59 60 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 58 def Time.now end |