downup 0.6.4 → 0.7.4
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 +4 -4
- data/README.md +16 -0
- data/downup-0.6.4.gem +0 -0
- data/examples/basic.rb +2 -0
- data/lib/downup/version.rb +1 -1
- data/lib/downup.rb +24 -14
- metadata +3 -3
- data/downup-0.5.4.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e8d62e2eb0a1759c717dd5d7d265bc0953522205
|
|
4
|
+
data.tar.gz: 4c4b849657a446d334d262aeda77c14b6e3bd2b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3552fad6e0d12819d4e7efb2b991605e224517741a850a48c2c4ef2a70375aaf35cb3eaee273716dd0095571d3081edb9a7dc3cbf6cc4ea4802de1f2be2ad116
|
|
7
|
+
data.tar.gz: 5e3918e403ead42633a6c5885127e37b043aaf26b744a0cf774f4d0fee7651d211c9acd7e35272ee47ce51ca49c65c027a23d6adda5a6664750f309bb8540800
|
data/README.md
CHANGED
|
@@ -75,6 +75,22 @@ Downup::Base.new(
|
|
|
75
75
|
default_color: :bg_gray,
|
|
76
76
|
selected_color: :cyan
|
|
77
77
|
).prompt
|
|
78
|
+
|
|
79
|
+
# You can also pass in a hash, and then quickly jump around,
|
|
80
|
+
# but the key
|
|
81
|
+
options = {
|
|
82
|
+
"a" => "Cat",
|
|
83
|
+
"b" => "Dog",
|
|
84
|
+
"c" => "Kangaroo",
|
|
85
|
+
"d" => "Snake",
|
|
86
|
+
"e" => "Eel"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
puts Downup::Base.new(options: options).prompt
|
|
90
|
+
|
|
91
|
+
# You can also pass in the selector you would like
|
|
92
|
+
# if passing in a hash
|
|
93
|
+
puts Downup::Base.new(options: options, selector: "†").prompt
|
|
78
94
|
```
|
|
79
95
|
|
|
80
96
|
## Inspired By
|
data/downup-0.6.4.gem
ADDED
|
Binary file
|
data/examples/basic.rb
CHANGED
data/lib/downup/version.rb
CHANGED
data/lib/downup.rb
CHANGED
|
@@ -8,14 +8,16 @@ module Downup
|
|
|
8
8
|
class Base
|
|
9
9
|
def initialize(options:,
|
|
10
10
|
title: nil,
|
|
11
|
-
default_color: :
|
|
12
|
-
selected_color: :
|
|
11
|
+
default_color: :brown,
|
|
12
|
+
selected_color: :magenta,
|
|
13
|
+
selector: "‣",
|
|
13
14
|
header_proc: Proc.new {})
|
|
14
15
|
|
|
15
16
|
@options = options
|
|
16
17
|
@title = title
|
|
17
18
|
@default_color = default_color
|
|
18
19
|
@selected_color = selected_color
|
|
20
|
+
@selector = selector
|
|
19
21
|
@header_proc = header_proc
|
|
20
22
|
@stdin = STDIN
|
|
21
23
|
@stdout = $stdout
|
|
@@ -38,6 +40,7 @@ module Downup
|
|
|
38
40
|
:selected_position,
|
|
39
41
|
:header_proc,
|
|
40
42
|
:selected_color,
|
|
43
|
+
:selector,
|
|
41
44
|
:default_color,
|
|
42
45
|
:stdin,
|
|
43
46
|
:stdout
|
|
@@ -78,22 +81,29 @@ module Downup
|
|
|
78
81
|
|
|
79
82
|
def print_options
|
|
80
83
|
case options
|
|
81
|
-
when Array
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
when Array then print_array_options
|
|
85
|
+
when Hash then print_hash_options
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def print_hash_options
|
|
90
|
+
options.each_with_index do |option_array, index|
|
|
91
|
+
if index == selected_position
|
|
92
|
+
stdout.puts "(#{eval("selector.#{selected_color}")}) " +
|
|
93
|
+
eval("option_array.last.#{selected_color}")
|
|
94
|
+
else
|
|
95
|
+
stdout.print "(#{eval("option_array.first.#{default_color}")}) "
|
|
96
|
+
stdout.print "#{eval("option_array.last.#{default_color}")}\n"
|
|
93
97
|
end
|
|
94
98
|
end
|
|
95
99
|
end
|
|
96
100
|
|
|
101
|
+
def print_array_options
|
|
102
|
+
options.each_with_index do |option, index|
|
|
103
|
+
stdout.puts colorize_option(option, index)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
97
107
|
def colorize_option(option, index)
|
|
98
108
|
if index == selected_position
|
|
99
109
|
eval("option.#{selected_color}")
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: downup
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Begin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-08-
|
|
11
|
+
date: 2015-08-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -55,7 +55,7 @@ files:
|
|
|
55
55
|
- Rakefile
|
|
56
56
|
- bin/console
|
|
57
57
|
- bin/setup
|
|
58
|
-
- downup-0.
|
|
58
|
+
- downup-0.6.4.gem
|
|
59
59
|
- downup.gemspec
|
|
60
60
|
- examples/basic.rb
|
|
61
61
|
- lib/downup.rb
|
data/downup-0.5.4.gem
DELETED
|
Binary file
|