Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/word_wrap/core_ext.rb
Overview
core_ext.rb
Copyright © 2015 Radek Pazdera Distributed under the MIT License
Optional core exensions, adding the fit and wrap methods to the String class
Instance Method Summary collapse
- #fit(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
- #fit!(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
- #wrap(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
- #wrap!(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
Instance Method Details
#fit(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
19 20 21 |
# File 'lib/word_wrap/core_ext.rb', line 19 def fit(width=WordWrap::DEFAULT_WIDTH) WordWrap.ww(self, width, true) end |
#fit!(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
23 24 25 |
# File 'lib/word_wrap/core_ext.rb', line 23 def fit!(width=WordWrap::DEFAULT_WIDTH) replace fit(width) end |
#wrap(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
11 12 13 |
# File 'lib/word_wrap/core_ext.rb', line 11 def wrap(width=WordWrap::DEFAULT_WIDTH) WordWrap.ww(self, width, false) end |
#wrap!(width = WordWrap::DEFAULT_WIDTH) ⇒ Object
15 16 17 |
# File 'lib/word_wrap/core_ext.rb', line 15 def wrap!(width=WordWrap::DEFAULT_WIDTH) replace wrap(width) end |