term-ansicolor 1.1.0 → 1.1.1

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: 7f55c51691dcf6121b58981a3be46ed4ec366de6
4
- data.tar.gz: 1c3e21a9d0eddf89f87a7c8320ffaa94eda84f21
3
+ metadata.gz: ec07d4e73ee2229632950fb11a792a7ac58d46fe
4
+ data.tar.gz: b131e1eb5f84b05ec06341874f13b95ff3c14d9a
5
5
  SHA512:
6
- metadata.gz: a41ad2f0632b9c2220ccc60d4a262c8b591dbb84910f28c5db2352b07b38b0944c747b9b803d777bcacde9885dddca32fe679bd3f3cb301641bc885d1264bf36
7
- data.tar.gz: ec5a09c6b8fdec985a092abe1c3743054f4b00ca7cd0dba4ea7b1f63d69a95b5bfc8a7b98b1fcec83ecd489e5f99ebf4913ddb63778af56b1f000623506abc7f
6
+ metadata.gz: 615c2efc5fa34346c987a16dec877656dae1a19f6893dc60c4a63f8a62393d785dbb932c898d3eb203ed223c9525fcc64a191ece401ea77d96eba44413b7cd8f
7
+ data.tar.gz: c96ce5a595656b357047bad7dfbdcddc19f37debfb51857a23ef8debd9327ec3e127a4905b7f1c96fd5f5d4f65db61a65c58e4d59a8cc69e55f1557b0d218b50
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ 2013-03-08 - 1.1.1 * Avoid possible conflicts with other people's attributes
2
+ methods.
3
+ * Cache attributes globally, also fix caching for frozen
4
+ strings.
1
5
  2013-03-07 - 1.1.0 * Cleanup documentation.
2
6
  * Implement color0 - color255 and on_color0 - on_color255
3
7
  methods for xterm256 colors.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -123,7 +123,7 @@ module Term
123
123
 
124
124
  module RespondTo
125
125
  def respond_to?(symbol, include_all = false)
126
- attributes.include?(symbol) or super
126
+ term_ansicolor_attributes.include?(symbol) or super
127
127
  end
128
128
  end
129
129
  include RespondTo
@@ -149,12 +149,23 @@ module Term
149
149
 
150
150
  alias uncolored uncolor
151
151
 
152
- # Returns an array of all Term::ANSIColor attributes as symbols.
153
- def attributes
154
- @attributes ||= ATTRIBUTE_NAMES +
155
- (0..255).map { |index| "color#{index}".to_sym } +
156
- (0..255).map { |index| "on_color#{index}".to_sym }
152
+ class << self
153
+ # Returns an array of all Term::ANSIColor attributes as symbols.
154
+ def term_ansicolor_attributes
155
+ @term_ansicolor_attributes ||= Term::ANSIColor::ATTRIBUTE_NAMES +
156
+ (0..255).map { |index| "color#{index}".to_sym } +
157
+ (0..255).map { |index| "on_color#{index}".to_sym }
158
+ end
159
+
160
+ alias attributes term_ansicolor_attributes
161
+ end
162
+
163
+ def term_ansicolor_attributes
164
+ ::Term::ANSIColor.term_ansicolor_attributes
157
165
  end
166
+
167
+ alias attributes term_ansicolor_attributes
168
+
158
169
  extend self
159
170
  end
160
171
  end
@@ -1,6 +1,6 @@
1
1
  module Term::ANSIColor
2
2
  # Term::ANSIColor version
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "term-ansicolor"
5
- s.version = "1.1.0"
5
+ s.version = "1.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Florian Frank"]
9
- s.date = "2013-03-07"
9
+ s.date = "2013-03-08"
10
10
  s.description = ""
11
11
  s.email = "flori@ping.de"
12
12
  s.executables = ["cdiff", "decolor"]
@@ -91,4 +91,12 @@ class ANSIColorTest < Test::Unit::TestCase
91
91
  def test_coloring_string_like
92
92
  assert_equal "\e[31mred\e[0m", red(string_like)
93
93
  end
94
+
95
+ def test_frozen
96
+ string = 'foo'
97
+ red = string.red
98
+ string.extend(Term::ANSIColor).freeze
99
+ assert string.frozen?
100
+ assert_equal red, string.red
101
+ end
94
102
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term-ansicolor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-07 00:00:00.000000000 Z
11
+ date: 2013-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar