runpaint-terminal-size 0.0.1 → 0.1.1

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/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :patch: 1
3
+ :major: 0
4
+ :minor: 1
data/lib/terminal/size.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  # = Introduction
3
- # TerminalSize is a library for finding the dimensions of the terminal a pRuby
3
+ # TerminalSize is a library for finding the dimensions of the terminal a Ruby
4
4
  # program is running on.
5
5
  #
6
6
  # = Using TerminalSize
@@ -71,3 +71,9 @@ class TerminalSize::FailedToGetSize < StandardError
71
71
  $stderr.puts @message
72
72
  end
73
73
  end
74
+ class TerminalSize::NotATTY < StandardError
75
+ # Exception thrown if the terminal is not a TTY.
76
+ def initialize
77
+ super "STDOUT is not a TTY."
78
+ end
79
+ end
@@ -8,6 +8,7 @@ class TerminalSize
8
8
  super
9
9
  end
10
10
  def get
11
+ raise NotATTY unless $stdout.tty?
11
12
  %w{ioctl stty}.each do |source|
12
13
  self.send("from_#{source}")
13
14
  return if self.valid?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runpaint-terminal-size
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Run Paint Run Run
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-06 00:00:00 -07:00
12
+ date: 2009-04-27 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -26,6 +26,7 @@ files:
26
26
  - LICENSE
27
27
  - README.markdown
28
28
  - Rakefile
29
+ - VERSION.yml
29
30
  - examples/termsize
30
31
  - lib/terminal/size.rb
31
32
  - lib/terminal/size/unix.rb