consenter 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/consenter.gemspec +2 -0
- data/lib/consenter.rb +8 -7
- data/lib/consenter/version.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 89a86c2232797da1824459d00346bdef5d1f4e58
|
4
|
+
data.tar.gz: cfa7558831963a515cba340a30a0a00baf27298f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b1bd9a8486e1af859f24a8177bda0891aaec458df76a622e42fb33ef38356316f8017d63096aec2563dd9b885d4be32510ff08b447dbedafe8674293d721f5c
|
7
|
+
data.tar.gz: e060466a5a72b5497f6273e3327d998bc3cf82e62a92b2dff77cba4187093a67233623b62da4b235e5a863a20293cb722151e8c022adc429f32e0a3a4e0f01df
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.8
|
data/consenter.gemspec
CHANGED
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'minitest'
|
26
27
|
spec.add_development_dependency 'pry'
|
28
|
+
spec.add_development_dependency 'pry-rescue'
|
27
29
|
spec.add_development_dependency 'rake'
|
28
30
|
spec.add_development_dependency 'rubocop'
|
29
31
|
end
|
data/lib/consenter.rb
CHANGED
@@ -27,9 +27,12 @@ class Consenter # :nodoc:
|
|
27
27
|
|
28
28
|
private_constant :ANSWERS
|
29
29
|
|
30
|
-
def initialize(prompt = '%s',
|
30
|
+
def initialize(prompt = '%s', options = {})
|
31
31
|
@prompt = prompt + ' [' + ANSWERS + '] '
|
32
|
-
|
32
|
+
|
33
|
+
@inspector = options.fetch(:inspector, :to_s)
|
34
|
+
@no_to_all = options.fetch(:none, false)
|
35
|
+
@yes_to_all = options.fetch(:all, false)
|
33
36
|
end
|
34
37
|
|
35
38
|
def consent_for?(arg)
|
@@ -61,8 +64,6 @@ class Consenter # :nodoc:
|
|
61
64
|
private :consent_for?
|
62
65
|
|
63
66
|
def for(enumerable, &block)
|
64
|
-
@yes_to_all = false
|
65
|
-
@no_to_all = false
|
66
67
|
enumerable.each do |arg|
|
67
68
|
case consent_for? arg
|
68
69
|
when true then block.yield(arg) # user pressed 'y' or 'Y'
|
@@ -75,11 +76,11 @@ class Consenter # :nodoc:
|
|
75
76
|
end
|
76
77
|
|
77
78
|
module Enumerable # :nodoc:
|
78
|
-
def each_consented(prompt = '%s',
|
79
|
+
def each_consented(prompt = '%s', options = {})
|
79
80
|
unless block_given?
|
80
|
-
return to_enum(__method__, prompt) do size; end
|
81
|
+
return to_enum(__method__, prompt, options) do size; end
|
81
82
|
end
|
82
|
-
Consenter.new(prompt,
|
83
|
+
Consenter.new(prompt, options).for(self) do |*args|
|
83
84
|
yield(*args)
|
84
85
|
end
|
85
86
|
end
|
data/lib/consenter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Vandenberk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: pry
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-rescue
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: rake
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
136
|
version: '0'
|
109
137
|
requirements: []
|
110
138
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.5.2.3
|
112
140
|
signing_key:
|
113
141
|
specification_version: 4
|
114
142
|
summary: Idiomatic Enumerable extension to filter by consent
|