Class: Tco::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/tco/style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fg = nil, bg = nil, bright = false, underline = false) ⇒ Style

Returns a new instance of Style.



28
29
30
31
32
33
# File 'lib/tco/style.rb', line 28

def initialize(fg=nil, bg=nil, bright=false, underline=false)
  @fg = fg
  @bg = bg
  @bright = bright
  @underline = underline
end

Instance Attribute Details

#bgObject

Returns the value of attribute bg.



26
27
28
# File 'lib/tco/style.rb', line 26

def bg
  @bg
end

#brightObject

Returns the value of attribute bright.



26
27
28
# File 'lib/tco/style.rb', line 26

def bright
  @bright
end

#fgObject

Returns the value of attribute fg.



26
27
28
# File 'lib/tco/style.rb', line 26

def fg
  @fg
end

#underlineObject

Returns the value of attribute underline.



26
27
28
# File 'lib/tco/style.rb', line 26

def underline
  @underline
end

Instance Method Details

#==(o) ⇒ Object



47
48
49
# File 'lib/tco/style.rb', line 47

def ==(o)
  @fg == o.fg && @bg == o.bg && @bright == o.bright && @underline == o.underline
end

#to_aObject



35
36
37
# File 'lib/tco/style.rb', line 35

def to_a
  [@fg, @bg, @bright, @underline]
end

#to_aryObject



43
44
45
# File 'lib/tco/style.rb', line 43

def to_ary
  to_a
end

#to_hObject



39
40
41
# File 'lib/tco/style.rb', line 39

def to_h
  {:fg => @fg, :bg => @bg, :bright => @bright, :underline => @underline}
end