interactive 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +8 -0
- data/lib/interactive.rb +1 -0
- data/lib/interactive/options.rb +1 -1
- data/lib/interactive/options_shortcuts.rb +39 -0
- data/lib/interactive/version.rb +1 -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: 68405e68b34a2a1d43f70b6957183eb97519e957
|
4
|
+
data.tar.gz: 9270c9246a10516500f8803527926ceefcf73523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aae4aef8c2ce8731857bd00e6e9e22eb05b4dc075ad89867cb3f9cd407220086adcc609027321f7da6b1baad7a1c2e7848ce504926293d36d36ed88f2aa1f5c9
|
7
|
+
data.tar.gz: e5883dbdeedd0e0aaf75ede9a0646e4488f43d1ab3ac38ce531e2b63c4a599b4de6afaba8b78eed4c356e6c9e7e0284d94262fd7675a335149f79427fd7d7324
|
data/CHANGELOG.markdown
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
v0.6.2 -- Sun Jun 28 22:57:18 EDT 2015
|
2
|
+
--------------------------------------
|
3
|
+
- Display condensed version of indices as a range.
|
4
|
+
|
5
|
+
v0.6.1 -- Sun Jun 28 22:57:18 EDT 2015
|
6
|
+
--------------------------------------
|
7
|
+
- pegged gem in runtime dependency because automatic update broke
|
8
|
+
|
1
9
|
v0.6.0 -- Sat Mar 28 22:32:12 EDT 2015
|
2
10
|
--------------------------------------
|
3
11
|
- added support for displaying tabular data
|
data/lib/interactive.rb
CHANGED
data/lib/interactive/options.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
module Interactive
|
2
|
+
class OptionsShortcuts
|
3
|
+
def initialize(minifiable_string)
|
4
|
+
@minifiable_string = minifiable_string
|
5
|
+
end
|
6
|
+
|
7
|
+
def minify
|
8
|
+
if has_only_one_number_or_none?
|
9
|
+
@minifiable_string
|
10
|
+
else
|
11
|
+
non_numerical_options.inject("#{numerical_options.min}..#{numerical_options.max}") do |accum, item|
|
12
|
+
"#{accum}/#{item}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def has_only_one_number_or_none?
|
20
|
+
numerical_options.min == numerical_options.max
|
21
|
+
end
|
22
|
+
|
23
|
+
def numerical_options
|
24
|
+
options.select {|option| numeric?(option)}
|
25
|
+
end
|
26
|
+
|
27
|
+
def non_numerical_options
|
28
|
+
options.reject {|option| numeric?(option)}
|
29
|
+
end
|
30
|
+
|
31
|
+
def options
|
32
|
+
@minifiable_string.split("/")
|
33
|
+
end
|
34
|
+
|
35
|
+
def numeric?(option)
|
36
|
+
option.match(/^\d+$/)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/interactive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edderic Ugaddan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/interactive.rb
|
103
103
|
- lib/interactive/option.rb
|
104
104
|
- lib/interactive/options.rb
|
105
|
+
- lib/interactive/options_shortcuts.rb
|
105
106
|
- lib/interactive/question.rb
|
106
107
|
- lib/interactive/question_with_eager_full_explanation.rb
|
107
108
|
- lib/interactive/question_with_lazy_full_explanation.rb
|