array-transitions 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/Gemfile +1 -0
- data/Rakefile +4 -3
- data/bin/console +4 -3
- data/lib/array_transitions.rb +5 -6
- data/lib/array_transitions/version.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 566d107966bbeae562d37a77ee1dfbfd28db792b
|
4
|
+
data.tar.gz: 111a9c07dc194209493a4d589ba38843f282286d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e7f70049cb539590ba0929ff1a0cd617cd6a0239c5839205485f95a3595fa6796a19ed482707b2ab66519514b429ea90911d76aca19f1482743a76d1bb2bbf9
|
7
|
+
data.tar.gz: 9fe6a875fed8f3032b6db58f1c23b34b510813b179464244667b19605996b222222b5f163ab34e586e20aedf3ef6528c6325df47aedeb2bd4ba245b4efed3852
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'array/transitions'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "array/transitions"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start
|
data/lib/array_transitions.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'array_transitions/version'
|
2
3
|
|
3
4
|
class Array
|
4
5
|
def transitions
|
5
|
-
|
6
|
-
next if
|
6
|
+
map.with_index do |e, i|
|
7
|
+
next if size == i + 1
|
7
8
|
|
8
9
|
next_element = self[i + 1]
|
9
10
|
next if next_element == e
|
10
11
|
|
11
12
|
{ from: e, to: next_element }
|
12
|
-
end
|
13
|
-
|
14
|
-
t.compact
|
13
|
+
end.compact
|
15
14
|
end
|
16
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: array-transitions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Bongart
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- ".gitignore"
|
49
49
|
- ".rspec"
|
50
|
+
- ".rubocop.yml"
|
50
51
|
- CODE_OF_CONDUCT.md
|
51
52
|
- Gemfile
|
52
53
|
- LICENSE.txt
|
@@ -78,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
81
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.5.1
|
82
83
|
signing_key:
|
83
84
|
specification_version: 4
|
84
85
|
summary: List transitions found in an array
|