Method: Sequel::Plugins::SubsetStaticCache::CachedDatasetMethods#map
- Defined in:
- lib/sequel/plugins/subset_static_cache.rb
#map(column = nil, &block) ⇒ Object
Use the cache instead of a query to get the results.
180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/sequel/plugins/subset_static_cache.rb', line 180 def map(column=nil, &block) return super unless all = @cache[:subset_static_cache_all] if column raise(Error, "Cannot provide both column and block to map") if block if column.is_a?(Array) all.map{|r| r.values.values_at(*column)} else all.map{|r| r[column]} end else all.map(&block) end end |