class XRayMachine::Options
Constants
- COLORS
Public Class Methods
new()
click to toggle source
# File lib/x_ray_machine/config.rb, line 21 def initialize @streams = {} end
Public Instance Methods
method_missing(name, config=nil)
click to toggle source
# File lib/x_ray_machine/config.rb, line 25 def method_missing(name, config=nil) name = name[0, name.size - 1] if name[name.size - 1] == "=" name = name.to_sym if config @streams[name] = fill_defaults_for(name, config) else @streams[name] ||= fill_defaults_for(name) end end
Private Instance Methods
available_colors()
click to toggle source
# File lib/x_ray_machine/config.rb, line 46 def available_colors used_colors = @streams.map{|_,o| o[:color] }.compact COLORS.keys - used_colors end
fill_defaults_for(name, config={})
click to toggle source
# File lib/x_ray_machine/config.rb, line 38 def fill_defaults_for(name, config={}) { title: name.to_s.gsub(/(^|_)([a-z])/) { |m| $2.upcase }, color: available_colors[0], show_in_summary: true }.merge config end