Module: BaseDatafier
Defined Under Namespace
Modules: DataFieldsClassMethods
Classes: HarvestError
Constant Summary
collapse
- BASE_HARVEST_DATA_FIELDS =
{
'Harvest When' => { property: :harvestWhen, comment: 'Date/Time of data harvesting' },
'Harvest Successful?' => { property: :harvestSuccessful, comment: 'Boolean - was harvesting successful?' },
'Harvest Message' => { property: :harvestMessage, comment: 'Usually indicates harvesting problem' },
'Persist When' => { property: :persistWhen, comment: 'Date/Time of data persistence to CSV file' },
}
- DETAILS_PROPERTY_FIELDS =
{
'Class' => { property: :klass, comment: 'The class the details are being recorded for. (Base)' },
'Detail' => { property: :detail, comment: 'The name of the field being recorded.' },
'Index' => { property: :index, comment: 'Recording sequence, i.e. 1: first, 2: second, etc.' },
'Line' => { property: :line, comment: 'The specific detail.' },
}
Instance Attribute Summary
Attributes included from FileProvider
#file_name
Class Method Summary
collapse
Instance Method Summary
collapse
backupFile, #backupFile, dataDir, dataDir=, #dataTextFile, getBackupFileName, getDataDir, getDataFileName, getDir, getLogDir, localDir, localDir=, logDir, logDir=, #openLogFile, #removeFile
Class Method Details
.included(base) ⇒ Object
41
42
43
|
# File 'lib/datafy/BaseDatafier.rb', line 41
def included(base)
base.extend DataFieldsClassMethods
end
|
Instance Method Details
#data_fields ⇒ Object
115
116
117
|
# File 'lib/datafy/BaseDatafier.rb', line 115
def data_fields
self.class.data_fields
end
|
#details_fields ⇒ Object
119
120
121
|
# File 'lib/datafy/BaseDatafier.rb', line 119
def details_fields
self.class.details_fields
end
|
#flattenTextLines(lines) ⇒ Object
127
128
129
|
# File 'lib/datafy/BaseDatafier.rb', line 127
def flattenTextLines lines
lines.is_a?(Enumerable) ? lines.join(' ') : lines.to_s
end
|
#logger ⇒ Object
module DataFieldsClassMethods
111
112
113
|
# File 'lib/datafy/BaseDatafier.rb', line 111
def logger
self.class.logger
end
|
#now ⇒ Object
123
124
125
|
# File 'lib/datafy/BaseDatafier.rb', line 123
def now
DateTime.now.strftime('%l:%M:%S%P %b %-d, %Y ').strip
end
|
#numify(str) ⇒ Object
131
132
133
134
135
136
|
# File 'lib/datafy/BaseDatafier.rb', line 131
def numify str
number = str.is_a?(String) ? str : str.to_s
number.gsub!(/[^0-9]/,'')
num_groups = number.to_s.chars.to_a.reverse.each_slice(3)
num_groups.map(&:join).join(',').reverse
end
|