Module: Pest::DataSet::ClassMethods
- Defined in:
- lib/pest/data_set.rb
Instance Method Summary collapse
- #from(data_source) ⇒ Object
- #from_file(*args) ⇒ Object
- #from_hash(*args) ⇒ Object
- #translators(*args) ⇒ Object
Instance Method Details
#from(data_source) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/pest/data_set.rb', line 71 def from(data_source) # Try to translate the data source directly if translator_method = translators[data_source.class] send(translator_method, data_source) # Try to translate via hash else begin hash_data = data_source.to_hash rescue NoMethodError raise "Unrecognized data source type" end if hash_data and translators.has_key?(hash_data.class) from(data_source.to_hash) end end end |
#from_file(*args) ⇒ Object
94 95 96 |
# File 'lib/pest/data_set.rb', line 94 def from_file(*args) raise NotImplementedError end |
#from_hash(*args) ⇒ Object
98 99 100 |
# File 'lib/pest/data_set.rb', line 98 def from_hash(*args) raise NotImplementedError end |
#translators(*args) ⇒ Object
90 91 92 |
# File 'lib/pest/data_set.rb', line 90 def translators(*args) raise NotImplementedError end |