Exception: Yay::TooManyColoursError

Inherits:
Error
  • Object
show all
Defined in:
lib/yay/errors.rb

Overview

raised when a colour sequence was malformed. in practice you can use infinite colour commands but zero to two actual colours, the first one will be the foreground and the second one will be the background

Instance Attribute Summary collapse

Attributes inherited from Error

#position

Instance Method Summary collapse

Methods inherited from Error

#printable_position

Constructor Details

#initialize(fg, bg, colour, position) ⇒ TooManyColoursError

Returns a new instance of TooManyColoursError.



145
146
147
148
149
150
# File 'lib/yay/errors.rb', line 145

def initialize fg, bg, colour, position
  @fg       = fg
  @bg       = bg
  @colour   = colour
  @position = position
end

Instance Attribute Details

#bgObject (readonly)

Returns the value of attribute bg.



142
143
144
# File 'lib/yay/errors.rb', line 142

def bg
  @bg
end

#colourObject (readonly)

Returns the value of attribute colour.



143
144
145
# File 'lib/yay/errors.rb', line 143

def colour
  @colour
end

#fgObject (readonly)

Returns the value of attribute fg.



141
142
143
# File 'lib/yay/errors.rb', line 141

def fg
  @fg
end

Instance Method Details

#printable_messageObject



152
153
154
# File 'lib/yay/errors.rb', line 152

def printable_message
  return "There were too many colours in your expression#{printable_position}.\nYou can't use #{colour} as you've already chosen a foreground and background colour"
end