Class: Megingiard::CenteredNode

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

Overview

A node with centered content

Instance Method Summary collapse

Constructor Details

#initialize(width, text) ⇒ CenteredNode

Returns a new instance of CenteredNode.



4
5
6
7
# File 'lib/megingiard/centered_node.rb', line 4

def initialize(width, text)
  @width = width
  @text = text
end

Instance Method Details

#to_sObject



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

def to_s
  @text.to_s.center(@width)
end