mvz-live_ast 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4396a6fdc53cf54aeb3b6266167f0068549d7d2c
4
- data.tar.gz: bdd39a8334d5f29c054d72c5125d21347b0dfa19
3
+ metadata.gz: 54c2bef5998513163fc9b5ab901c9a0736051980
4
+ data.tar.gz: b9cde24a8e1daff48cf8f0554ae327fa001b36a6
5
5
  SHA512:
6
- metadata.gz: 81b894dcecb96cb803a65c06d77f99f374a91c877721dd5d6fd220b7f5bf79fe5a951d0426d65973d99d404146d146977995942b0ee7344bf3c6c685f2d128c6
7
- data.tar.gz: 8ff9b6c24ff52fffd01bb0acca72c391fdab696b5954892da9a98441859eaf109da06798a9362ff347cc221204325ccafdf4c743cc3c08a71e0c3f1d69b3eb10
6
+ metadata.gz: f7cba61dc5781d0d817804e024fe473c9f8c3a4c59c4a71d0b2d488a9a1e34528df1db5473166a43bf44f5fe37a7001c7517ad077efe57e865c6d0eba5e343ae
7
+ data.tar.gz: 134c897d7ec68c3b633b5345bd59647f9fcbcdeec36c01c65667bb1fc3c496190fbf03b3a93c8c85cef92ce84e082ad98fa4f43aea8d491a291222db8bcfcb79
@@ -9,7 +9,10 @@ module LiveAST
9
9
  rescue NameError
10
10
  thing = if arg.nil? then nil else arg.class end
11
11
 
12
- raise TypeError, "can't convert #{thing.inspect} into String"
12
+ raise TypeError,
13
+ RUBY_VERSION < "2.0.0" ?
14
+ "can't convert #{thing.inspect} into String" :
15
+ "no implicit conversion of #{thing.inspect} into String"
13
16
  end
14
17
  end
15
18
 
@@ -22,9 +25,12 @@ module LiveAST
22
25
  end
23
26
  end
24
27
 
25
- def check_type(obj, klass)
26
- unless obj.is_a? klass
27
- raise TypeError, "wrong argument type #{obj.class} (expected #{klass})"
28
+ def check_is_binding(obj)
29
+ unless obj.is_a? Binding
30
+ raise TypeError,
31
+ RUBY_VERSION < "2.1.0" ?
32
+ "wrong argument type #{obj.class} (expected Binding)" :
33
+ "wrong argument type #{obj.class} (expected binding)"
28
34
  end
29
35
  end
30
36
 
@@ -23,7 +23,7 @@ module LiveAST
23
23
  args.tap do
24
24
  check_arity(args, 2..4)
25
25
  args[0] = arg_to_str(args[0])
26
- check_type(args[1], Binding)
26
+ check_is_binding(args[1])
27
27
  args[2] = arg_to_str(args[2]) if args[2]
28
28
  end
29
29
  end
@@ -30,15 +30,20 @@ module LiveAST
30
30
  end
31
31
 
32
32
  def handle_args(args)
33
- if args.empty?
34
- raise ArgumentError, "block not supplied"
35
- end
36
-
37
- args[0] = Common.arg_to_str(args[0])
38
-
39
- unless (1..3).include? args.size
40
- raise ArgumentError,
41
- "wrong number of arguments: instance_eval(src) or instance_eval{..}"
33
+ if RUBY_VERSION < '2.0.0'
34
+ if args.empty?
35
+ raise ArgumentError, "block not supplied"
36
+ end
37
+
38
+ args[0] = Common.arg_to_str(args[0])
39
+
40
+ unless (1..3).include? args.size
41
+ raise ArgumentError,
42
+ "wrong number of arguments: instance_eval(src) or instance_eval{..}"
43
+ end
44
+ else
45
+ LiveAST::Common.check_arity(args, 1..3)
46
+ args[0] = Common.arg_to_str(args[0])
42
47
  end
43
48
 
44
49
  args[1] = Common.arg_to_str(args[1]) if args[1]
@@ -1,3 +1,3 @@
1
1
  module LiveAST
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -19,6 +19,12 @@ class AllEncodingTest < RegularTest
19
19
  koi8_shebang KOI8-R
20
20
  ]]
21
21
 
22
+ if RUBY_VERSION < '2.0.0'
23
+ ENC_TESTS['default'] = 'US-ASCII'
24
+ else
25
+ ENC_TESTS['default'] = 'UTF-8'
26
+ end
27
+
22
28
  ENC_TESTS.each_pair do |abbr, name|
23
29
  define_method "test_#{abbr}" do
24
30
  require_relative "encoding_test/#{abbr}"
@@ -158,13 +158,14 @@ class ZZY_ReplaceEvalTest < ReplaceEvalTest
158
158
  assert_equal orig.message, live.message
159
159
 
160
160
  [[nil], [Object.new], [3], [4,3,2], (1..10).to_a].each do |args|
161
- orig = assert_raises TypeError do
161
+ orig = assert_raises ArgumentError, TypeError do
162
162
  Object.new.live_ast_original_instance_eval(*args)
163
163
  end
164
- live = assert_raises TypeError do
164
+ live = assert_raises ArgumentError, TypeError do
165
165
  Object.new.instance_eval(*args)
166
166
  end
167
167
  assert_equal orig.message, live.message
168
+ assert_equal orig.class, live.class
168
169
  end
169
170
  end
170
171
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mvz-live_ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James M. Lawrence
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-13 00:00:00.000000000 Z
12
+ date: 2014-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_parser
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: 3.2.2
20
+ version: 3.3.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: 3.2.2
27
+ version: 3.3.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: ruby2ruby
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -272,4 +272,3 @@ test_files:
272
272
  - test/define_method_test.rb
273
273
  - test/backtrace_test.rb
274
274
  - test/encoding_test.rb
275
- has_rdoc: