dialog_tui 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cc4111fc60ccfa00f25c354883d8233ccc4403a
4
- data.tar.gz: eadbe40fc4cb0f2bbce8d0ac330fa43cd32010d0
3
+ metadata.gz: 0910fad969d36fb4dae62b0cc4eda1381c478f94
4
+ data.tar.gz: 0c94e240249f1ddccb6b4c294c7e09450594436b
5
5
  SHA512:
6
- metadata.gz: af1502d916d0ef9393f8d6416ea8868fc0005c40c12173aa333afee867dcd2673d73cdeb5b6f46414ce7c30d6aacc0f40e5ad52bc8b41653aad4d442f0109287
7
- data.tar.gz: 6de6835c282ed968217bc50ce8b29b05ecc5ff9fa4b5e65075742c334ac67ab3458bfbe935486f031dbbb3e9ebd3835aaf03a8fe87d426fef49e4e1d8382613a
6
+ metadata.gz: 3a9eabc75a05bf3863ee1b83f4ac58e0e88cfdb4a5d3b8e93c77cab4eb4cc15b890c3a897b18df371a360695c66fcd3b451b97ea97200ebe60173301099c8d18
7
+ data.tar.gz: 32295a1394687422ba983c7ad664eeee7f0c8de1c8ade7320cf12035a115d7050fab2077e42de1a6b145d93139b2dd42888b851b0de614436b65f5b93c74ab31
@@ -1,3 +1,3 @@
1
1
  module DialogTui
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/dialog_tui.rb CHANGED
@@ -75,6 +75,10 @@ module DialogTui
75
75
  key.enter do
76
76
  done = true
77
77
  end
78
+
79
+ key.ctrl_c do
80
+ @ctrl_c.each(&:call) if @ctrl_c
81
+ end
78
82
  }
79
83
  end until done
80
84
 
@@ -90,6 +94,11 @@ module DialogTui
90
94
  @options.push option
91
95
  end
92
96
 
97
+ def ctrl_c &block
98
+ @ctrl_c ||= []
99
+ @ctrl_c << block
100
+ end
101
+
93
102
  private
94
103
  def print_options
95
104
  puts '-'*10
@@ -162,6 +171,12 @@ if __FILE__ == $0
162
171
  option '3. bye' do
163
172
  puts '*waving*'
164
173
  end
174
+
175
+ ctrl_c do
176
+ puts 'ctrl+c worked!'
177
+ exit 0
178
+ end
179
+
165
180
  }.
166
181
  tap { |result|
167
182
  raise unless result.nil?
@@ -171,10 +186,10 @@ if __FILE__ == $0
171
186
  end
172
187
  end
173
188
 
174
- puts '-----'
175
- puts '3 times - choose any option:'
176
- puts '-----'
189
+ puts
190
+ puts ?_*10
177
191
  puts 'manual testing here - use arrows and enter'
178
192
  puts 'no way to fail it - just look at behavior'
179
- 3.times { My.new.act }
193
+ puts 'ctrl+c when finished'
194
+ My.new.act
180
195
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dialog_tui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander K