Class: FormatR::CenterFormatter

Inherits:
Formatter show all
Defined in:
lib/formatr.rb

Overview

Format things that go to the center, ala |

Instance Method Summary collapse

Methods inherited from Formatter

#changeVarValue, #setVarValue

Constructor Details

#initialize(val) ⇒ CenterFormatter

Returns a new instance of CenterFormatter.



638
639
640
641
# File 'lib/formatr.rb', line 638

def initialize (val)
  super
  @len = val.size()
end

Instance Method Details

#formatString(s, var_name, binding) ⇒ Object

center things



644
645
646
647
# File 'lib/formatr.rb', line 644

def formatString (s, var_name, binding)
  s = super
  s.center(@len)
end