Module: GlTail::Configurable

Included in:
Block, Column, Screen, Source::Base, Resolver
Defined in:
lib/gl_tail/config/configurable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



47
48
49
# File 'lib/gl_tail/config/configurable.rb', line 47

def self.included(receiver)
  receiver.extend ClassMethods
end

Instance Method Details

#config_rewrite_color(v) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/gl_tail/config/configurable.rb', line 33

def config_rewrite_color(v)
  case v
  when /(.+),(.+),(.+),(.+)/
    value = v.split(',')
  else
    value = GlTail::COLORS[v.downcase]
    unless value
      raise SyntaxError, "You must use either [#{GlTail::COLORS.keys.sort.join('|')}] or a color in RGBA format."
    end
    value.map! { |x| x.to_i / 255.0 }
  end
  value.map {|x| x.to_f }
end