Skip to content

Commit

Permalink
more clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
drusellers authored and rauhryan committed Dec 21, 2011
1 parent eb1a17e commit fc40030
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions 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...
Expand Down
6 changes: 3 additions & 3 deletions 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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions 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

Expand Down

0 comments on commit fc40030

Please sign in to comment.