Class: PostRunner::FFS_Monitoring
- Inherits:
-
PEROBS::Object
- Object
- PEROBS::Object
- PostRunner::FFS_Monitoring
- Includes:
- DirUtils
- Defined in:
- lib/postrunner/FFS_Monitoring.rb
Overview
The FFS_Monitoring objects can store a reference to the FIT file data and caches some frequently used values.
Instance Method Summary collapse
-
#<=>(a) ⇒ Object
FFS_Monitoring objects are sorted by their start time values and then by their device long_uids.
-
#initialize(p, device, fit_file_name, fit_entity) ⇒ FFS_Monitoring
constructor
Create a new FFS_Monitoring object.
-
#store_fit_file(fit_file_name) ⇒ Object
Store a copy of the given FIT file in the corresponding directory.
Methods included from DirUtils
Constructor Details
#initialize(p, device, fit_file_name, fit_entity) ⇒ FFS_Monitoring
Create a new FFS_Monitoring object.
32 33 34 35 36 37 38 39 40 |
# File 'lib/postrunner/FFS_Monitoring.rb', line 32 def initialize(p, device, fit_file_name, fit_entity) super(p) self.device = device self.fit_file_name = fit_file_name ? File.basename(fit_file_name) : nil self.name = fit_file_name ? File.basename(fit_file_name) : nil extract_summary_values(fit_entity) end |
Instance Method Details
#<=>(a) ⇒ Object
FFS_Monitoring objects are sorted by their start time values and then by their device long_uids.
61 62 63 64 65 |
# File 'lib/postrunner/FFS_Monitoring.rb', line 61 def <=>(a) @period_start == a.period_start ? a.device.long_uid <=> self.device.long_uid : a.period_start <=> @period_start end |
#store_fit_file(fit_file_name) ⇒ Object
Store a copy of the given FIT file in the corresponding directory.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/postrunner/FFS_Monitoring.rb', line 44 def store_fit_file(fit_file_name) # Get the right target directory for this particular FIT file. dir = @store['file_store'].fit_file_dir(File.basename(fit_file_name), @device.long_uid, 'monitor') # Create the necessary directories if they don't exist yet. create_directory(dir, 'Device monitoring diretory') # Copy the file into the target directory. begin FileUtils.cp(fit_file_name, dir) rescue StandardError Log.fatal "Cannot copy #{fit_file_name} into #{dir}: #{$!}" end end |