Sha256: 231bf05a444c986201d294eb98356d39ef47def9aaf1ce1416f230cfd731488e
Contents?: true
Size: 674 Bytes
Versions: 2
Compression:
Stored size: 674 Bytes
Contents
require 'singleton' module Erector class Cache include Singleton def []=(*args) value = args.pop ::Rails.cache.write(transform_key(args), value.to_s) end def [](*args) ::Rails.cache.read(transform_key(args)) end def delete(*args) ::Rails.cache.delete(transform_key(args)) end def transform_key(args) ['erector'] + args.reject { |x| x.nil? }.map { |x| if x.is_a?(Hash) transformed = {} x.each do |k, v| transformed[k] = v.respond_to?(:cache_key) ? v.cache_key : v end transformed else x end } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
erector-rails4-0.0.2 | lib/erector/cache.rb |
erector-rails4-0.0.1 | lib/erector/cache.rb |