array-tweaks 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +5 -1
- data/Gemfile.lock +6 -6
- data/LICENSE +21 -0
- data/README.md +6 -3
- data/Rakefile +3 -3
- data/array-tweaks.gemspec +10 -14
- data/lib/array-tweaks/version.rb +1 -1
- data/test/helper.rb +6 -0
- data/test/test-array-tweaks.rb +19 -6
- metadata +7 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1232d121fcc67f7e7882a80a37eea04be80491b52904a501b2fd303243af14f4
|
4
|
+
data.tar.gz: 1d9e8cbe4c59064dc88eb3e7e2ed3b9f16ed321c803b4fca0d9fa2cfdb9f01f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f7d22cf7bebf545f786a832f00d078c3a82fe82d1aee1dde3ff81952e7e3831d6e8a0206bd6a6ec48e7aa699ca744bbc80f83c10b39bc781445a0d49666d375
|
7
|
+
data.tar.gz: 7d0877a98921bc82a360518c8ba8f7a3cc8124df6c7a57dd9976d51ffaf9dc4a9d86e617d1df32a520ddbb7d5b7a28b202cbcf2a569c5e1f91b383d50d1f0cf9
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
array-tweaks (1.0.
|
4
|
+
array-tweaks (1.0.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
power_assert (1.
|
10
|
-
rake (12.
|
11
|
-
test-unit (3.2.
|
9
|
+
power_assert (1.1.3)
|
10
|
+
rake (12.3.1)
|
11
|
+
test-unit (3.2.8)
|
12
12
|
power_assert
|
13
13
|
|
14
14
|
PLATFORMS
|
@@ -17,8 +17,8 @@ PLATFORMS
|
|
17
17
|
DEPENDENCIES
|
18
18
|
array-tweaks!
|
19
19
|
bundler (~> 1.7)
|
20
|
-
rake (~> 12.
|
20
|
+
rake (~> 12.3)
|
21
21
|
test-unit (~> 3.2)
|
22
22
|
|
23
23
|
BUNDLED WITH
|
24
|
-
1.
|
24
|
+
1.16.5
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Yaroslav Konoplov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
##
|
1
|
+
## A gem extending Ruby's array with useful utilities.
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/array-tweaks.svg)](https://badge.fury.io/rb/array-tweaks)
|
4
4
|
[![Build Status](https://travis-ci.org/yivo/array-tweaks.svg?branch=master)](https://travis-ci.org/yivo/array-tweaks)
|
5
5
|
|
6
6
|
## Current features
|
7
|
+
|
7
8
|
* `drop_last`
|
8
9
|
* `drop_last!`
|
9
10
|
* `each_with_index_and_size`
|
@@ -11,13 +12,15 @@
|
|
11
12
|
* `map_key`
|
12
13
|
|
13
14
|
## Installing gem
|
15
|
+
|
14
16
|
Add to your Gemfile:
|
15
17
|
```ruby
|
16
|
-
gem
|
18
|
+
gem "array-tweaks", "~> 1.0"
|
17
19
|
```
|
18
20
|
|
19
21
|
## Running tests
|
20
|
-
|
22
|
+
|
23
|
+
Install Bundler:
|
21
24
|
```bash
|
22
25
|
gem install bundler
|
23
26
|
```
|
data/Rakefile
CHANGED
data/array-tweaks.gemspec
CHANGED
@@ -1,23 +1,19 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require File.expand_path(
|
4
|
+
require File.expand_path("../lib/array-tweaks/version", __FILE__)
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
7
|
+
s.name = "array-tweaks"
|
8
8
|
s.version = ArrayTweaks::VERSION
|
9
|
-
s.author =
|
10
|
-
s.email =
|
11
|
-
s.summary = "
|
12
|
-
s.description = "
|
13
|
-
s.homepage =
|
14
|
-
s.license =
|
15
|
-
|
9
|
+
s.author = "Yaroslav Konoplov"
|
10
|
+
s.email = "eahome00@gmail.com"
|
11
|
+
s.summary = "Utilities for Ruby's array."
|
12
|
+
s.description = "A gem extending Ruby's array with useful utilities."
|
13
|
+
s.homepage = "https://github.com/yivo/array-tweaks"
|
14
|
+
s.license = "MIT"
|
16
15
|
s.files = `git ls-files -z`.split("\x0")
|
17
16
|
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
|
18
|
-
s.require_paths = [
|
19
|
-
|
20
|
-
s.add_development_dependency 'bundler', '~> 1.7'
|
21
|
-
s.add_development_dependency 'rake', '~> 12.0'
|
22
|
-
s.add_development_dependency 'test-unit', '~> 3.2'
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.add_development_dependency "bundler", "~> 1.7"
|
23
19
|
end
|
data/lib/array-tweaks/version.rb
CHANGED
data/test/helper.rb
ADDED
data/test/test-array-tweaks.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
Bundler.require :default, :development, :test
|
4
|
+
require_relative "helper"
|
6
5
|
|
7
6
|
class ArrayTweaksTest < Test::Unit::TestCase
|
8
7
|
def test_drop_last
|
9
|
-
x = [1,2,3,4]
|
8
|
+
x = [1, 2, 3, 4]
|
10
9
|
y = x.drop_last
|
11
|
-
assert_equal [1,2,3], y
|
10
|
+
assert_equal [1, 2, 3], y
|
12
11
|
assert_not_same x, y
|
13
12
|
|
14
|
-
x = [1,2,3,4]
|
13
|
+
x = [1, 2, 3, 4]
|
15
14
|
assert_equal 4, x.drop_last!
|
16
|
-
assert_equal [1,2,3], x
|
15
|
+
assert_equal [1, 2, 3], x
|
17
16
|
assert_same x, x
|
18
17
|
|
19
18
|
x = []
|
@@ -34,4 +33,18 @@ class ArrayTweaksTest < Test::Unit::TestCase
|
|
34
33
|
i_outer += 1
|
35
34
|
end
|
36
35
|
end
|
36
|
+
|
37
|
+
def test_each_after
|
38
|
+
array = []
|
39
|
+
(1..5).to_a.each_after(3) { |x| array << x }
|
40
|
+
assert_equal [4, 5], array
|
41
|
+
|
42
|
+
array = []
|
43
|
+
(1..5).to_a.each_after(0) { |x| array << x }
|
44
|
+
assert_equal [1, 2, 3, 4, 5], array
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_map_key
|
48
|
+
assert_equal ["a", "b", nil, "c"], [{ k: "a" }, { k: "b" }, {}, { k: "c" }].map_key(:k)
|
49
|
+
end
|
37
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: array-tweaks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Konoplov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,35 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
|
-
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '12.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '12.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: test-unit
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.2'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.2'
|
55
|
-
description: Responsibly extends Ruby's Array with simple and predictable utilities.
|
27
|
+
description: A gem extending Ruby's array with useful utilities.
|
56
28
|
email: eahome00@gmail.com
|
57
29
|
executables: []
|
58
30
|
extensions: []
|
@@ -62,11 +34,13 @@ files:
|
|
62
34
|
- ".travis.yml"
|
63
35
|
- Gemfile
|
64
36
|
- Gemfile.lock
|
37
|
+
- LICENSE
|
65
38
|
- README.md
|
66
39
|
- Rakefile
|
67
40
|
- array-tweaks.gemspec
|
68
41
|
- lib/array-tweaks.rb
|
69
42
|
- lib/array-tweaks/version.rb
|
43
|
+
- test/helper.rb
|
70
44
|
- test/test-array-tweaks.rb
|
71
45
|
homepage: https://github.com/yivo/array-tweaks
|
72
46
|
licenses:
|
@@ -91,6 +65,7 @@ rubyforge_project:
|
|
91
65
|
rubygems_version: 2.7.6
|
92
66
|
signing_key:
|
93
67
|
specification_version: 4
|
94
|
-
summary:
|
68
|
+
summary: Utilities for Ruby's array.
|
95
69
|
test_files:
|
70
|
+
- test/helper.rb
|
96
71
|
- test/test-array-tweaks.rb
|