Skip to content

Commit

Permalink
Fixes instance of Ruby version = 1.8.7 for Kernel method (for real)
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Love committed Apr 28, 2009
1 parent b8e4538 commit d899782
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/aws/s3/extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def to_header
module Kernel
def __method__(depth = 0)
caller[depth][/`([^']+)'/, 1]
end if RUBY_VERSION < '1.8.7'
end if RUBY_VERSION <= '1.8.7'

def __called_from__
caller[1][/`([^']+)'/, 1]
end if RUBY_VERSION >= '1.8.7'
end if RUBY_VERSION > '1.8.7'

def expirable_memoize(reload = false, storage = nil)
current_method = RUBY_VERSION >= '1.8.7' ? __called_from__ : __method__(1)
current_method = RUBY_VERSION > '1.8.7' ? __called_from__ : __method__(1)
storage = "@#{storage || current_method}"
if reload
instance_variable_set(storage, nil)
Expand Down
2 changes: 1 addition & 1 deletion test/extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test___method___depth
assert_equal 'foo', b.foo
assert_equal 'bar', b.bar
end
end if RUBY_VERSION < '1.8.7'
end if RUBY_VERSION <= '1.8.7'

class ModuleExtensionsTest < Test::Unit::TestCase
class Foo
Expand Down

0 comments on commit d899782

Please sign in to comment.