Sha256: 5b0667bd8640f20faf37f9788e0bc435e2ef5e4dadbf51872c8ca33d5eb16674

Contents?: true

Size: 391 Bytes

Versions: 31

Compression:

Stored size: 391 Bytes

Contents

module ApiResource
  module Decorators
    class CachingDecorator
      attr_reader :owner
      attr_reader :ttl

      def initialize(owner, ttl)
        @owner = owner
        @ttl = ttl
      end


      def method_missing(method_name, *args, &block)
        ApiResource.with_ttl(self.ttl) do
          self.owner.send(method_name, *args, &block)
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
api_resource-0.6.5 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.6.4 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.6.3 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.6.2 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.6.1 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.6.0 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.5.1 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.5.0 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.4.3 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.4.2 lib/api_resource/decorators/caching_decorator.rb
api_resource-0.4.0 lib/api_resource/decorators/caching_decorator.rb