Class: FMCache::Helper
- Inherits:
-
Object
- Object
- FMCache::Helper
- Defined in:
- lib/fmcache/helper.rb
Class Method Summary collapse
Class Method Details
.sort(values, ids) ⇒ <Hash>
14 15 16 17 18 19 |
# File 'lib/fmcache/helper.rb', line 14 def sort(values, ids) id_map = ids.map.with_index { |id, i| [id, i] }.to_h values.sort do |a, b| id_map.fetch(a.fetch(:id)) <=> id_map.fetch(b.fetch(:id)) end end |
.to_fields(field_mask, prefix: []) ⇒ <String>
7 8 9 |
# File 'lib/fmcache/helper.rb', line 7 def to_fields(field_mask, prefix: []) field_mask.to_paths(prefix: prefix, sort: false) end |