Module: HasCache::Utilities
Overview
Container for utility methods
Instance Method Summary collapse
Instance Method Details
#extract_result(result) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/has_cache/utilities.rb', line 4 def extract_result(result) if result.is_a?(ActiveRecord::Relation) if result.respond_to?(:load) && result.method(:load).owner == ActiveRecord::Relation result.load elsif result.respond_to?(:to_a) result.to_a end end result end |
#merged_options(target, local_options) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/has_cache/utilities.rb', line 16 def (target, ) if target.is_a?(Class) = target. else = target.class. end .delete(:key) if target.respond_to?(:has_cache_key) .merge() end |