Class: Backframe::Response::Record
- Inherits:
-
Object
- Object
- Backframe::Response::Record
- Defined in:
- lib/backframe/response/record.rb
Class Method Summary collapse
Class Method Details
.cast_path(path) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/backframe/response/record.rb', line 22 def cast_path(path) if path.is_a?(String) path.split(".") elsif path.is_a?(Symbol) path.to_s.split(".") elsif path.is_a?(Array) path end end |
.get_value(record, path) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/backframe/response/record.rb', line 11 def get_value(record, path) path = cast_path(path) index = 0 length = path.length while record != nil && index < length record = record.with_indifferent_access[path[index]] index += 1 end record end |