Class: Megingiard::ColorNode

Inherits:
Object
  • Object
show all
Defined in:
lib/megingiard/color_node.rb

Overview

A node that colors all its children in a given color

Instance Method Summary collapse

Constructor Details

#initialize(color_name, child) ⇒ ColorNode

Returns a new instance of ColorNode.



8
9
10
11
# File 'lib/megingiard/color_node.rb', line 8

def initialize(color_name, child)
  @color_sequence = TextColorSequence.new(color_name)
  @child = child
end

Instance Method Details

#to_sObject



13
14
15
# File 'lib/megingiard/color_node.rb', line 13

def to_s
  "#{@color_sequence}#{@child}#{RESET_SEQUENCE}"
end