Class: XRayMachine::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/x_ray_machine/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, color, show_in_summary) ⇒ Config

Returns a new instance of Config.



64
65
66
67
68
# File 'lib/x_ray_machine/config.rb', line 64

def initialize(title, color, show_in_summary)
  @title = title
  @color = XRayMachine::Options::COLORS[color] || XRayMachine::Options::COLORS[:red]
  @show_in_summary = show_in_summary
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



53
54
55
# File 'lib/x_ray_machine/config.rb', line 53

def color
  @color
end

#show_in_summaryObject (readonly) Also known as: show_in_summary?

Returns the value of attribute show_in_summary.



53
54
55
# File 'lib/x_ray_machine/config.rb', line 53

def show_in_summary
  @show_in_summary
end

#titleObject (readonly)

Returns the value of attribute title.



53
54
55
# File 'lib/x_ray_machine/config.rb', line 53

def title
  @title
end

Class Method Details

.for(stream) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/x_ray_machine/config.rb', line 55

def self.for(stream)
  options = XRayMachine.options.__send__ stream
  title   = options[:title]
  color   = options[:color]
  show_in_summary = options[:show_in_summary]

  new title, color, show_in_summary
end

Instance Method Details

#to_hObject



72
73
74
# File 'lib/x_ray_machine/config.rb', line 72

def to_h
  {title: title, color: color, show_in_summary: show_in_summary}
end