its-it 1.3.0 → 2.0.0
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 +5 -5
- data/README.md +4 -1
- data/its-it.gemspec +1 -0
- data/lib/its-it/it.rb +3 -3
- data/lib/its-it/version.rb +1 -1
- data/spec/it_spec.rb +12 -8
- data/spec/rspec_compatibility_spec.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f1f6a4b053ef34ba91f453a9ca02fb417c272ff809388495a7305ffa0df48d32
|
4
|
+
data.tar.gz: 494832c699a13a34401757bc915e62eaf94e3c147d29e8fe5517448b4696e8e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e40f49a07ecb80ea873b3bf78d415bd96b357f6e3c1f478f3f306adfda1b326c71a99fd07874fb34d2871a2a50309f43b4efe22c99de1e3ffb9126a751e6a18
|
7
|
+
data.tar.gz: 9d7889759739aa30597012fbb23aac386f404df0ed9f256f518fc9f3c2f8347c9964c8bcb152924e55911318b645a8ce6cfcb9def0e2767017f420bab1ab1c76
|
data/README.md
CHANGED
@@ -130,7 +130,9 @@ gem "its-it"
|
|
130
130
|
|
131
131
|
## Compatibility
|
132
132
|
|
133
|
-
Tested on MRI ruby
|
133
|
+
Tested on MRI ruby 2.7.1
|
134
|
+
|
135
|
+
(MRI ruby 1.9.3, 2.1.9, 2.2.5, and 2.3.1 were supported up through version 1.3.0)
|
134
136
|
|
135
137
|
(MRI ruby 1.8.7 was supported up through version 1.1.1)
|
136
138
|
|
@@ -138,6 +140,7 @@ Tested on MRI ruby 1.9.3, 2.1.9, 2.2.5, and 2.3.1
|
|
138
140
|
|
139
141
|
Release Notes
|
140
142
|
|
143
|
+
* 2.0.0 Switch to Ruby 2.7 keyword syntax. No other breaking changes.
|
141
144
|
* 1.3.0 Add `#key` and `#value` for Hash comprehensions; plus minor internal cleanup.
|
142
145
|
* 1.2.1 Don't leak all of ItsIt into main, just ItsIt::Kernel. Thanks to [klg](https://github.com/kjg)
|
143
146
|
* 1.2.0 Add support for Hash comprehensions; drop support for ruby 1.8.7
|
data/its-it.gemspec
CHANGED
@@ -25,6 +25,7 @@ for ruby 1.9 and gemspec compatibility and adding the case statement functionali
|
|
25
25
|
"LICENSE.txt",
|
26
26
|
]
|
27
27
|
|
28
|
+
s.required_ruby_version = '~> 2.7'
|
28
29
|
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.7')
|
29
30
|
s.rubygems_version = '1.3.7'
|
30
31
|
s.specification_version = 3
|
data/lib/its-it/it.rb
CHANGED
@@ -18,8 +18,8 @@ module ItsIt
|
|
18
18
|
@queue = []
|
19
19
|
end
|
20
20
|
|
21
|
-
def method_missing(method, *args, &block)
|
22
|
-
@queue << [method, args, block] unless method == :respond_to? and [:to_proc, :===].include?(args.first.to_sym)
|
21
|
+
def method_missing(method, *args, **kw, &block)
|
22
|
+
@queue << [method, args, kw, block] unless method == :respond_to? and [:to_proc, :===].include?(args.first.to_sym)
|
23
23
|
self
|
24
24
|
end
|
25
25
|
|
@@ -38,7 +38,7 @@ module ItsIt
|
|
38
38
|
when 1 then obj = obj.shift # array comprehension, gets one arg
|
39
39
|
when 2 then obj.extend(KeyValAccessors) # hash comprehension, gets two args
|
40
40
|
end
|
41
|
-
@queue.inject(obj) { |chain,(method, args,block)| chain.send(method, *args, &block) }
|
41
|
+
@queue.inject(obj) { |chain,(method, args, kw, block)| chain.send(method, *args, **kw, &block) }
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
data/lib/its-it/version.rb
CHANGED
data/spec/it_spec.rb
CHANGED
@@ -19,19 +19,23 @@ describe ItsIt::It do
|
|
19
19
|
it "should work with a simple method using ===" do
|
20
20
|
expect((it.length) === TestString).to eq(TestString.length)
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "should work with arguments" do
|
24
24
|
expect((it.sub(/test/, 'kumquat')).call(TestString)).to eq('This is a kumquat')
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
|
+
it "should work with keyword arguments" do
|
28
|
+
expect((it.lines(chomp:true)).call(TestString + "\n")).to eq([TestString])
|
29
|
+
end
|
30
|
+
|
27
31
|
it "should work with a block" do
|
28
32
|
expect((it.sub(/test/) {"balloon"}).to_proc.call(TestString)).to eq('This is a balloon')
|
29
33
|
end
|
30
|
-
|
34
|
+
|
31
35
|
it "should chain methods" do
|
32
36
|
expect((it.reverse.swapcase.succ).to_proc.call(TestString)).to eq("TSET A SI SIHu")
|
33
37
|
end
|
34
|
-
|
38
|
+
|
35
39
|
it "should respond to to_proc()" do
|
36
40
|
expect(it).to respond_to(:to_proc)
|
37
41
|
end
|
@@ -48,15 +52,15 @@ describe ItsIt::It do
|
|
48
52
|
|
49
53
|
context "hash comprehension" do
|
50
54
|
it "presents `key` accessor" do
|
51
|
-
expect({a: 1, b:2}.select
|
55
|
+
expect({a: 1, b:2}.select(&(it.key == :b))).to eq({b:2})
|
52
56
|
end
|
53
57
|
|
54
58
|
it "presents `value` accessor" do
|
55
|
-
expect({a: 1, b:2}.select
|
59
|
+
expect({a: 1, b:2}.select(&(it.value == 2))).to eq({b:2})
|
56
60
|
end
|
57
61
|
|
58
62
|
it "presents as an array" do
|
59
|
-
expect({a: 1, b:2}.select
|
63
|
+
expect({a: 1, b:2}.select(&(it[1] == 2))).to eq({b:2})
|
60
64
|
end
|
61
65
|
|
62
66
|
end
|
@@ -71,7 +75,7 @@ describe ItsIt::It do
|
|
71
75
|
end
|
72
76
|
end
|
73
77
|
end
|
74
|
-
|
78
|
+
|
75
79
|
it "should not queue the method respond_to? when given :to_proc as an arg" do
|
76
80
|
expect(it.respond_to? :to_proc).to be_true
|
77
81
|
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: its-it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronen Barzel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2011-04-26 00:00:00.000000000 Z
|
@@ -131,24 +131,23 @@ files:
|
|
131
131
|
homepage: http://github.com/ronen/its-it
|
132
132
|
licenses: []
|
133
133
|
metadata: {}
|
134
|
-
post_install_message:
|
134
|
+
post_install_message:
|
135
135
|
rdoc_options: []
|
136
136
|
require_paths:
|
137
137
|
- lib
|
138
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- - "
|
140
|
+
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
142
|
+
version: '2.7'
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
145
|
- - ">="
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: 1.3.7
|
148
148
|
requirements: []
|
149
|
-
|
150
|
-
|
151
|
-
signing_key:
|
149
|
+
rubygems_version: 3.1.2
|
150
|
+
signing_key:
|
152
151
|
specification_version: 3
|
153
152
|
summary: Defines its() and it() method-chain proxies.
|
154
153
|
test_files:
|