highline 1.6.9 → 1.6.10

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.
data/CHANGELOG CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
+ == 1.6.10
6
+
7
+ * Fixed a regression that prevented asking for String arguments (by Jeffery
8
+ Sman.)
9
+ * Fixed a testing incompatibility (by Hans de Graaff.)
10
+
5
11
  == 1.6.9
6
12
 
7
13
  * The new list modes now properly ignore escapes when sizing.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require "rubygems"
6
6
 
7
7
  dir = File.dirname(__FILE__)
8
8
  lib = File.join(dir, "lib", "highline.rb")
9
- version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
9
+ version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d+\.\d+\.\d+)\1/, 2]
10
10
 
11
11
  task :default => [:test]
12
12
 
@@ -2,7 +2,7 @@ DIR = File.dirname(__FILE__)
2
2
  LIB = File.join(DIR, *%w[lib highline.rb])
3
3
  VERSION = open(LIB) { |lib|
4
4
  lib.each { |line|
5
- if v = line[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
5
+ if v = line[/^\s*VERSION\s*=\s*(['"])(\d+\.\d+\.\d+)\1/, 2]
6
6
  break v
7
7
  end
8
8
  }
@@ -30,7 +30,7 @@ require "highline/style"
30
30
  #
31
31
  class HighLine
32
32
  # The version of the installed library.
33
- VERSION = "1.6.9".freeze
33
+ VERSION = "1.6.10".freeze
34
34
 
35
35
  # An internal HighLine error. User code does not need to trap this.
36
36
  class QuestionError < StandardError
@@ -302,7 +302,7 @@ class HighLine
302
302
  def convert( answer_string )
303
303
  if @answer_type.nil?
304
304
  answer_string
305
- elsif @answer_type == HighLine::String
305
+ elsif [::String, HighLine::String].include?(@answer_type)
306
306
  HighLine::String(answer_string)
307
307
  elsif [Float, Integer, String].include?(@answer_type)
308
308
  Kernel.send(@answer_type.to_s.to_sym, answer_string)
@@ -71,6 +71,8 @@ class HighLine
71
71
  # *WARNING*: This method requires the "termios" library!
72
72
  #
73
73
  def get_character( input = STDIN )
74
+ return input.getbyte if input.is_a? StringIO
75
+
74
76
  old_settings = Termios.getattr(input)
75
77
 
76
78
  new_settings = old_settings.dup
@@ -62,6 +62,16 @@ class TestHighLine < Test::Unit::TestCase
62
62
  assert_raise(EOFError) { @terminal.ask("Any input left? ") }
63
63
  end
64
64
 
65
+ def test_ask_string
66
+ name = "James Edward Gray II"
67
+ @input << name << "\n"
68
+ @input.rewind
69
+
70
+ assert_equal(name, @terminal.ask("What is your name? ", String))
71
+
72
+ assert_raise(EOFError) { @terminal.ask("Any input left? ", String) }
73
+ end
74
+
65
75
  def test_bug_fixes
66
76
  # auto-complete bug
67
77
  @input << "ruby\nRuby\n"
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.9
4
+ version: 1.6.10
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: 2011-12-18 00:00:00.000000000 Z
12
+ date: 2012-01-24 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