highline 1.6.14 → 1.6.15

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
+ == 1.6.15
6
+
7
+ * Added support for nil arguments in lists (by Eric Saxby).
8
+ * Fixed HighLine's termios integration (by Jens Wille).
9
+
5
10
  == 1.6.14
6
11
 
7
12
  * Added JRuby 1.7 support (by Mina Nagy).
@@ -28,7 +28,7 @@ require "highline/style"
28
28
  #
29
29
  class HighLine
30
30
  # The version of the installed library.
31
- VERSION = "1.6.14".freeze
31
+ VERSION = "1.6.15".freeze
32
32
 
33
33
  # An internal HighLine error. User code does not need to trap this.
34
34
  class QuestionError < StandardError
@@ -425,7 +425,11 @@ class HighLine
425
425
  #
426
426
  def list( items, mode = :rows, option = nil )
427
427
  items = items.to_ary.map do |item|
428
- ERB.new(item, nil, "%").result(binding)
428
+ if item.nil?
429
+ ""
430
+ else
431
+ ERB.new(item, nil, "%").result(binding)
432
+ end
429
433
  end
430
434
 
431
435
  if items.empty?
@@ -103,15 +103,15 @@ class HighLine
103
103
  CHARACTER_MODE = "termios" # For Debugging purposes only.
104
104
 
105
105
  def raw_no_echo_mode
106
- @state = Termios.getattr(input)
106
+ @state = Termios.getattr(@input)
107
107
  new_settings = @state.dup
108
108
  new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)
109
109
  new_settings.c_cc[Termios::VMIN] = 1
110
- Termios.setattr(input, Termios::TCSANOW, new_settings)
110
+ Termios.setattr(@input, Termios::TCSANOW, new_settings)
111
111
  end
112
112
 
113
113
  def restore_mode
114
- Termios.setattr(input, Termios::TCSANOW, @state)
114
+ Termios.setattr(@input, Termios::TCSANOW, @state)
115
115
  end
116
116
  rescue LoadError # If our first choice fails, try using JLine
117
117
  if JRUBY # if we are on JRuby. JLine is bundled with JRuby.
@@ -572,6 +572,14 @@ class TestHighLine < Test::Unit::TestCase
572
572
  assert_equal("", result)
573
573
  end
574
574
  end
575
+
576
+ def test_lists_with_nil_items
577
+ modes = [nil]
578
+ modes.each do |mode|
579
+ result = @terminal.list([nil], mode)
580
+ assert_equal("\n", result)
581
+ end
582
+ end
575
583
 
576
584
  def test_lists_with_one_item
577
585
  items = ['Zero']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.14
4
+ version: 1.6.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-25 00:00:00.000000000 Z
12
+ date: 2012-09-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'A high-level IO library that provides validation, type conversion,
15
15
  and more for