predicated 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,7 @@ require "predicated/from/ruby_code_string"
5
5
  module Predicated
6
6
 
7
7
  require_gem_version("ParseTree", "3.0.5", "parse_tree") if RUBY_VERSION < "1.9"
8
- require "predicated/sexp_patch"
9
-
8
+
10
9
  class Predicate
11
10
 
12
11
  #hrm
@@ -36,6 +35,44 @@ module Predicated
36
35
  ruby_code_string.sub(/^def serializable\n /, "").sub(/\nend$/, "")
37
36
  end
38
37
  end
38
+
39
+ #see http://gist.github.com/321038
40
+ # # Monkey-patch to have Ruby2Ruby#translate with r2r >= 1.2.3, from
41
+ # # http://seattlerb.rubyforge.org/svn/ruby2ruby/1.2.2/lib/ruby2ruby.rb
42
+ class ::Ruby2Ruby < ::SexpProcessor
43
+ def self.translate(klass_or_str, method = nil)
44
+ sexp = ParseTree.translate(klass_or_str, method)
45
+ unifier = Unifier.new
46
+ unifier.processors.each do |p|
47
+ p.unsupported.delete :cfunc # HACK
48
+ end
49
+ sexp = unifier.process(sexp)
50
+ self.new.process(sexp)
51
+ end
52
+
53
+ #sconover - 7/2010 - monkey-patch
54
+ #{1=>2}=={1=>2}
55
+ #The right side was having its braces cut off because of
56
+ #special handling of hashes within arglists within the seattlerb code.
57
+ #I tried to fork r2r and add a test, but a lot of other tests
58
+ #broke, and I just dont understand the test in ruby2ruby.
59
+ #So I'm emailing the author...
60
+ def process_hash(exp)
61
+ result = []
62
+ until exp.empty?
63
+ lhs = process(exp.shift)
64
+ rhs = exp.shift
65
+ t = rhs.first
66
+ rhs = process rhs
67
+ rhs = "(#{rhs})" unless [:lit, :str].include? t # TODO: verify better!
39
68
 
69
+ result << "#{lhs} => #{rhs}"
70
+ end
71
+
72
+ return "{ #{result.join(', ')} }"
73
+ end
74
+
75
+ end
76
+
40
77
  end
41
78
  end
@@ -5,7 +5,6 @@ module Predicated
5
5
 
6
6
  require_gem_version("ruby_parser", "2.0.4")
7
7
  require_gem_version("ruby2ruby", "1.2.4")
8
- require "predicated/sexp_patch"
9
8
 
10
9
  class Predicate
11
10
  def self.from_ruby_code_string(ruby_predicate_string, context=binding())
@@ -1,3 +1,3 @@
1
1
  module Predicated
2
- VERSION = "0.2.1" unless defined?(Predicated::VERSION)
2
+ VERSION = "0.2.2" unless defined?(Predicated::VERSION)
3
3
  end
@@ -1,6 +1,7 @@
1
1
  dir = File.dirname(__FILE__)
2
2
  $LOAD_PATH.unshift "#{dir}/../lib"
3
- $LOAD_PATH.unshift "../wrong/lib"
3
+ $LOAD_PATH.unshift "../wrong/lib" # this assumes that Wrong is checked out as a sibling
4
+
4
5
  require "rubygems"
5
6
  require "minitest/spec"
6
7
  require "pp"
@@ -2,5 +2,4 @@ require "./test/test_helper"
2
2
 
3
3
  require "wrong"
4
4
  require "wrong/adapters/minitest"
5
- require "wrong/message/test_context"
6
- require "wrong/message/string_diff"
5
+ require "wrong/message/string_comparison"
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: predicated
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 2
9
- - 1
10
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Steve Conover
13
+ - Alex Chaffee
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
@@ -39,7 +39,6 @@ files:
39
39
  - lib/predicated/predicate.rb
40
40
  - lib/predicated/print.rb
41
41
  - lib/predicated/selectable.rb
42
- - lib/predicated/sexp_patch.rb
43
42
  - lib/predicated/simple_templated_predicate.rb
44
43
  - lib/predicated/string_utils.rb
45
44
  - lib/predicated/to/arel.rb
@@ -90,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
89
  requirements:
91
90
  - - ">="
92
91
  - !ruby/object:Gem::Version
93
- hash: 3
92
+ hash: 4570885310046635928
94
93
  segments:
95
94
  - 0
96
95
  version: "0"
@@ -99,7 +98,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
98
  requirements:
100
99
  - - ">="
101
100
  - !ruby/object:Gem::Version
102
- hash: 3
103
101
  segments:
104
102
  - 0
105
103
  version: "0"
@@ -1,39 +0,0 @@
1
-
2
-
3
- #see http://gist.github.com/321038
4
- # # Monkey-patch to have Ruby2Ruby#translate with r2r >= 1.2.3, from
5
- # # http://seattlerb.rubyforge.org/svn/ruby2ruby/1.2.2/lib/ruby2ruby.rb
6
- class ::Ruby2Ruby < ::SexpProcessor
7
- def self.translate(klass_or_str, method = nil)
8
- sexp = ParseTree.translate(klass_or_str, method)
9
- unifier = Unifier.new
10
- unifier.processors.each do |p|
11
- p.unsupported.delete :cfunc # HACK
12
- end
13
- sexp = unifier.process(sexp)
14
- self.new.process(sexp)
15
- end
16
-
17
- #sconover - 7/2010 - monkey-patch
18
- #{1=>2}=={1=>2}
19
- #The right side was having its braces cut off because of
20
- #special handling of hashes within arglists within the seattlerb code.
21
- #I tried to fork r2r and add a test, but a lot of other tests
22
- #broke, and I just dont understand the test in ruby2ruby.
23
- #So I'm emailing the author...
24
- def process_hash(exp)
25
- result = []
26
- until exp.empty?
27
- lhs = process(exp.shift)
28
- rhs = exp.shift
29
- t = rhs.first
30
- rhs = process rhs
31
- rhs = "(#{rhs})" unless [:lit, :str].include? t # TODO: verify better!
32
-
33
- result << "#{lhs} => #{rhs}"
34
- end
35
-
36
- return "{ #{result.join(', ')} }"
37
- end
38
-
39
- end