Class: Thorderbolt::ParamsExtractor
- Inherits:
-
Object
- Object
- Thorderbolt::ParamsExtractor
- Defined in:
- lib/thorderbolt/params_extractor.rb
Overview
Recursively search through the hash to find the last elements:
-
The name of the table we want to condition on
-
The attribute name
-
The attribute values for ordering by.
Class Method Summary collapse
Class Method Details
.call(hash, table_name) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/thorderbolt/params_extractor.rb', line 9 def self.call(hash, table_name) raise ParamsParsingError, 'Could not parse params' unless hash.size == 1 key, value = hash.first return call(hash[key], key) if value.is_a? Hash { table_name: table_name, attribute: key, values: value } end |