diff --git a/stint/stint/lib/stint.rb b/stint/stint/lib/stint.rb index c629eac4..079a3800 100644 --- a/stint/stint/lib/stint.rb +++ b/stint/stint/lib/stint.rb @@ -1,6 +1,7 @@ require "stint/version" require "stint/github" require "stint/pebble" +require "stint/cache" module Stint # Your code goes here... diff --git a/stint/stint/lib/stint/cache.rb b/stint/stint/lib/stint/cache.rb index adb0b3aa..34087313 100644 --- a/stint/stint/lib/stint/cache.rb +++ b/stint/stint/lib/stint/cache.rb @@ -1,11 +1,11 @@ -module stint +module Stint module Cache @the_wrapped_methods = [] @alias = {} @cache = {} - def cache(method_name) + def self.cache(method_name) @the_wrapped_methods << method_name end @@ -20,7 +20,7 @@ def cache_call(args) #cache check key = args.join #how? if @cache[key].nil? - result = @alias[method](args) + result = @alias[method] cache[key] = result end if result diff --git a/stint/stint/specs/cache.rspec b/stint/stint/specs/cache.rspec index bd42a821..87f3d4bc 100644 --- a/stint/stint/specs/cache.rspec +++ b/stint/stint/specs/cache.rspec @@ -1,8 +1,8 @@ require "rspec" -require "stint/stint/lib/stint" +require "lib/stint" class Bob - include Cache + include Stint::Cache cache :bob