Commit 8d49ec68 authored by Matija Čupić's avatar Matija Čupić

Use symbol instead of string in RedisCacheable attribute definitions

parent 4fd77b33
...@@ -7,7 +7,7 @@ module RedisCacheable ...@@ -7,7 +7,7 @@ module RedisCacheable
class_methods do class_methods do
def cached_attr_reader(*attributes) def cached_attr_reader(*attributes)
attributes.each do |attribute| attributes.each do |attribute|
define_method("#{attribute}") do define_method(attribute) do
cached_attribute(attribute) || read_attribute(attribute) cached_attribute(attribute) || read_attribute(attribute)
end end
end end
...@@ -15,7 +15,7 @@ module RedisCacheable ...@@ -15,7 +15,7 @@ module RedisCacheable
def cached_attr_time_reader(*attributes) def cached_attr_time_reader(*attributes)
attributes.each do |attribute| attributes.each do |attribute|
define_method("#{attribute}") do define_method(attribute) do
cached_value = cached_attribute(attribute) cached_value = cached_attribute(attribute)
cached_value ? Time.zone.parse(cached_value) : read_attribute(attribute) cached_value ? Time.zone.parse(cached_value) : read_attribute(attribute)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment