Module: Hipbot::Cache::ClassMethods

Defined in:
lib/hipbot/utilities/cache.rb

Instance Method Summary collapse

Instance Method Details

#attr_cache(*attributes, &block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/hipbot/utilities/cache.rb', line 14

def attr_cache *attributes, &block
  attributes.each do |attr_name|
    define_method(attr_name) do
      _cache[attr_name] ||= block_given? ? instance_eval(&block) : []
    end
  end
end