summaryrefslogtreecommitdiff
path: root/lib/highline/style.rb
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-02-27 12:17:29 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-02-27 12:17:29 -0300
commite7ed37d5b29df1f07249a7f1472017d6f506b02b (patch)
tree421e81322f0b5b8ec4e917dabdf21fa9e18faddd /lib/highline/style.rb
parent3def16d7ef1e048875af8144bfc1ef635edbc89d (diff)
downloadhighline-e7ed37d5b29df1f07249a7f1472017d6f506b02b.tar.gz
Begin implementation of HighLine::Style.clear_index
There was a commented HighLine::Style.clear_index on teardown of tc_style.rb tests. Begin implementation of it preserving builtin styles. This is important to ensure a clean enviroment for each test.
Diffstat (limited to 'lib/highline/style.rb')
-rwxr-xr-xlib/highline/style.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/highline/style.rb b/lib/highline/style.rb
index 3f83527..92f0b84 100755
--- a/lib/highline/style.rb
+++ b/lib/highline/style.rb
@@ -54,6 +54,11 @@ class HighLine
style
end
+ def self.clear_index
+ # reset to builtin only styles
+ @@styles = list.select { |name, style| style.builtin }
+ end
+
def self.rgb_hex(*colors)
colors.map do |color|
color.is_a?(Numeric) ? '%02x'%color : color.to_s