Skip to content

Commit

Permalink
Fixed incompatibilities with 1.8.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngty committed Sep 16, 2010
1 parent 2ee3ffd commit d1bfbe4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ begin
gem.add_dependency "ruby2ruby", ">= 1.2.5"
gem.add_dependency "sexp_processor", ">= 3.0.5"
gem.add_dependency "sourcify", ">= 0.2.3"
gem.required_ruby_version = '>= 1.8.7'
gem.required_ruby_version = '>= 1.8.6'
# TODO: How do we declare the following optional dependencies ??
# 1. gem.add_dependency "memcache-client", "= 1.8.5"
# 2. gem.add_dependency "redis", "= 2.0.3"
Expand Down
1 change: 1 addition & 0 deletions lib/cross-stub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require 'cross-stub/stubber'
require 'cross-stub/arguments'
require 'cross-stub/stores'
require 'cross-stub/fixes'

module CrossStub

Expand Down
2 changes: 1 addition & 1 deletion lib/cross-stub/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def refresh(opts)
private

def init(opts, truncate)
type, arg = opts.to_a[0].map(&:to_s)
type, arg = opts.to_a[0].map{|o| o.to_s }
@store =
begin
store_name = '%s%s' % [type[0..0].upcase, type[1..-1].downcase]
Expand Down
8 changes: 8 additions & 0 deletions lib/cross-stub/fixes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 1.8.6 doesn't support String#end_with?
unless ''.respond_to?(:end_with?)
class String
def end_with?(s)
((idx = self.length - s.length) < 0) ? false : (self[idx .. -1] == s)
end
end
end
2 changes: 1 addition & 1 deletion lib/cross-stub/stubber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def m_eval(str)
alias_method :t_eval, :m_eval

def has_method?(method)
@thing.instance_methods.map(&:to_s).include?(method.to_s)
@thing.instance_methods.map{|m| m.to_s }.include?(method.to_s)
end

end
Expand Down
2 changes: 1 addition & 1 deletion spec/includes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
RUBY_VM = [
RUBY_VERSION.gsub(/[^\d]/,''),
RUBY_PLATFORM =~ /java/i ? 'j' : '',
RUBY_DESCRIPTION =~ /enterprise/i ? 'e' : ''
(Object.const_defined?(:RUBY_DESCRIPTION) ? RUBY_DESCRIPTION : '') =~ /enterprise/i ? 'e' : ''
].join

PROJECT_ROOT = File.join(File.dirname(File.expand_path(__FILE__)), '..')
Expand Down

0 comments on commit d1bfbe4

Please sign in to comment.