Sha256: 59c5c82f209e5f97a626c4e82f2d62ec68e9eccbbc891b832791f4641dff2072

Contents?: true

Size: 408 Bytes

Versions: 2

Compression:

Stored size: 408 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'megingiard/text_color_sequence'
require 'megingiard/reset_sequence'

module Megingiard
  # A node that colors all its children in a given color
  class ColorNode
    def initialize(color_name, child)
      @color_sequence = TextColorSequence.new(color_name)
      @child = child
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
megingiard-0.1.0 lib/megingiard/color_node.rb
megingiard-0.0.1 lib/megingiard/color_node.rb