downup 0.8.6 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9898dc304ec5a8c0b0f65cf926ff407158e14e97
4
- data.tar.gz: 1c60bbc2aaeaa7bb0fbfb8a1394605c9fdd655dd
3
+ metadata.gz: f842e61e8bd58bae4db8fc93580498fcc5798e8a
4
+ data.tar.gz: 24295105184635b519fc1e952e88963fe1bb811f
5
5
  SHA512:
6
- metadata.gz: 2d7cf553acd560e9a30531eff1d31186597f76f6d69e0cec0e053c2f43042d3ec39fa5fa6e30ee0efd21b991a7d250e5e4beab18121098bad45846c08fa37cf5
7
- data.tar.gz: 4c313a98ae894bd3680a9a7a6a3e06a7c6ee5c9a5d4978d5e9f774e4189be274958b5a42d68bf38572ece441b96a0ba5310e9492c9d10bfd61be01269e931517
6
+ metadata.gz: 746815cffd6a3d4fec7882595794dab2a05b84675eb214614068bb871aeb5ce43d108ec656b3effd1eeb201bc2a33095c2de3ea5e34557c1d4bb8167723e1733
7
+ data.tar.gz: 67821fe72ea37dd0945bf74fbb7dda269ae644721e3c95a8c1e944ff82be62cf0a1cf63fe4ebed8432dce6c5eafb45450960b566851bba09b2810738ae87a334
data/README.md CHANGED
@@ -32,8 +32,8 @@ options = [
32
32
 
33
33
  Downup::Base.new(options: options).prompt
34
34
 
35
- # You can also pass a title when initializing
36
- Downup::Base.new(options: options, title: "Animals: \n").prompt
35
+ # You can also pass a flash message and color when initializing
36
+ Downup::Base.new(options: options, flash_color: :green, flash_message: "Animals: \n").prompt
37
37
 
38
38
  # you can pass a callable header
39
39
  # to print out before the menu
data/downup-0.8.6.gem ADDED
Binary file
data/examples/basic.rb CHANGED
@@ -11,7 +11,7 @@ puts Downup::Base.new(options: options).prompt
11
11
 
12
12
  puts Downup::Base.new(
13
13
  options: options,
14
- title: "Choose an Animal: \n"
14
+ header_proc: -> { "Choose an Animal: \n" }
15
15
  ).prompt
16
16
 
17
17
  def header
@@ -22,7 +22,8 @@ end
22
22
 
23
23
  puts Downup::Base.new(
24
24
  options: options,
25
- title: "Choose an Animal: \n",
25
+ flash_message: "Choose an Animal: \n",
26
+ flash_color: :red,
26
27
  header_proc: method(:header)
27
28
  ).prompt
28
29
 
data/lib/downup.rb CHANGED
@@ -8,7 +8,8 @@ module Downup
8
8
 
9
9
  class Base
10
10
  def initialize(options:,
11
- title: nil,
11
+ flash_message: nil,
12
+ flash_color: :green,
12
13
  default_color: :brown,
13
14
  selected_color: :magenta,
14
15
  selector: "‣",
@@ -17,7 +18,8 @@ module Downup
17
18
  header_proc: Proc.new {})
18
19
 
19
20
  @options = options
20
- @title = title
21
+ @flash_color = flash_color
22
+ @flash_message = flash_message
21
23
  @default_color = default_color
22
24
  @selected_color = selected_color
23
25
  @selector = selector
@@ -31,7 +33,7 @@ module Downup
31
33
  @selected_position = position_selector(position)
32
34
  colonel.system("clear")
33
35
  header_proc.call
34
- print_title
36
+ print_flash
35
37
  Downup::OptionsPrinter.new(
36
38
  options: options,
37
39
  selected_position: @selected_position,
@@ -47,7 +49,8 @@ module Downup
47
49
  private
48
50
 
49
51
  attr_reader :options,
50
- :title,
52
+ :flash_message,
53
+ :flash_color,
51
54
  :selected_position,
52
55
  :header_proc,
53
56
  :selected_color,
@@ -103,9 +106,10 @@ module Downup
103
106
  else position; end
104
107
  end
105
108
 
106
- def print_title
107
- return if title.nil?
108
- stdout.puts "#{title}".red
109
+ def print_flash
110
+ return if flash_message.nil?
111
+ colored_flash = "\"#{flash_message}\".#{flash_color}"
112
+ stdout.puts eval(colored_flash)
109
113
  end
110
114
 
111
115
  def read_char
@@ -1,3 +1,3 @@
1
1
  module Downup
2
- VERSION = "0.8.6"
2
+ VERSION = "0.9.6"
3
3
  end
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.8.6
4
+ version: 0.9.6
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-10 00:00:00.000000000 Z
11
+ date: 2015-08-15 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.8.5.gem
58
+ - downup-0.8.6.gem
59
59
  - downup.gemspec
60
60
  - examples/basic.rb
61
61
  - lib/downup.rb
data/downup-0.8.5.gem DELETED
Binary file