instance method
center
Ruby on Rails 3.2.22.5
Since v2.2.3 Last seen in v3.2.22.5Signature
center(integer, padstr=' ')
Works just like String#center, only integer specifies characters instead of bytes.
Example:
"¾ cup".mb_chars.center(8).to_s # => " ¾ cup " "¾ cup".mb_chars.center(8, " ").to_s # Use non-breaking whitespace # => " ¾ cup "
Parameters
-
integerreq -
padstropt = ' '
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 234
def center(integer, padstr=' ')
justify(integer, :center, padstr)
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 234
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars