Class: Megingiard::CenteredNode
- Inherits:
-
Object
- Object
- Megingiard::CenteredNode
- Defined in:
- lib/megingiard/centered_node.rb
Overview
A node with centered content
Instance Method Summary collapse
-
#initialize(width, text) ⇒ CenteredNode
constructor
A new instance of CenteredNode.
- #to_s ⇒ Object
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_s ⇒ Object
9 10 11 |
# File 'lib/megingiard/centered_node.rb', line 9 def to_s @text.to_s.center(@width) end |