riel 1.1.13 → 1.1.14

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.
@@ -40,6 +40,11 @@ module Text
40
40
  def initialize
41
41
  @aliases = Hash.new
42
42
  end
43
+
44
+ def to_codes str
45
+ names = parse_colors str
46
+ names_to_code names
47
+ end
43
48
 
44
49
  def codes names
45
50
  names.collect { |name| ATTRIBUTES[name] }.compact
data/lib/riel.rb CHANGED
@@ -4,7 +4,7 @@ $:.unshift(riellibdir) unless
4
4
  $:.include?(riellibdir) || $:.include?(File.expand_path(riellibdir))
5
5
 
6
6
  module RIEL
7
- VERSION = '1.1.13'
7
+ VERSION = '1.1.14'
8
8
  end
9
9
 
10
10
  rbfiles = Dir[riellibdir + "/riel/**/*.rb"]
@@ -122,4 +122,22 @@ class AnsiHighlightTestCase < Test::Unit::TestCase
122
122
  # puts str
123
123
  assert_equal "\x1b[48;5;54mABC\e[0m", str
124
124
  end
125
+
126
+ def test_to_codes_one_color
127
+ hl = Text::ANSIHighlighter.instance
128
+ code = hl.to_codes 'blue'
129
+ assert_equal "\e[34m", code
130
+ end
131
+
132
+ def test_to_codes_decoration_color
133
+ hl = Text::ANSIHighlighter.instance
134
+ code = hl.to_codes 'bold blue'
135
+ assert_equal "\e[1m\e[34m", code
136
+ end
137
+
138
+ def test_to_codes_background_color
139
+ hl = Text::ANSIHighlighter.instance
140
+ code = hl.to_codes 'on_blue'
141
+ assert_equal "\e[44m", code
142
+ end
125
143
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 13
10
- version: 1.1.13
9
+ - 14
10
+ version: 1.1.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Pace
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-08 00:00:00 -05:00
18
+ date: 2012-12-09 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21