Skip to content

Commit

Permalink
Fix Ruby 1.9.2 compatibility.
Browse files Browse the repository at this point in the history
Autotest now runs in 1.9.2 mode, Rcov in 1.8.7 mode.
  • Loading branch information
Darrick Wiebe committed Mar 22, 2011
1 parent 6e783ea commit 815e7e9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .autotest
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'autotest/timestamp'
ENV['RUBY'] = 'jruby --1.9'
Autotest.add_hook(:initialize) {|at|
at.add_exception %r{^\.git} # ignore Version Control System
at.add_exception %r{^\./tmp} # ignore temp files, lest autotest will run again, and again...
nil
}

20 changes: 15 additions & 5 deletions lib/pacer/neo4j.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,21 @@ def encode_property(value)
end
end

def decode_property(value)
if value.is_a? String and value[0, 3] == '---'
YAML.load(value)
else
value
if RUBY_VERSION =~ /^1.9/
def decode_property(value)
if value.is_a? String and value[0, 5] == '%YAML'
YAML.load(value)
else
value
end
end
else
def decode_property(value)
if value.is_a? String and value[0, 3] == '---'
YAML.load(value)
else
value
end
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/pacer/pipe/enumerable_pipe.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module Pacer::Pipes
class EnumerablePipe < RubyPipe
Enumerator = Enumerable::Enumerator if RUBY_VERSION !~ /^1.9/

def initialize(enumerable)
super()
case enumerable
when Enumerable::Enumerator
when Enumerator
starts = enumerable
when Pacer::ElementMixin
starts = [enumerable].to_enum
Expand Down
2 changes: 1 addition & 1 deletion spec/pacer/core/graph/element_route_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
specify 'should all be hashes' do
props = subject.each
elements = r.each
elements.zip(props).each do |e, p|
elements.zip(props.to_a).each do |e, p|
e.properties.should == p
end
end
Expand Down

0 comments on commit 815e7e9

Please sign in to comment.