Class: RSpecLive::FormattedText
- Inherits:
-
Object
- Object
- RSpecLive::FormattedText
- Defined in:
- lib/rspec-live/formatted_text.rb
Instance Method Summary collapse
-
#initialize(text, options = {}) ⇒ FormattedText
constructor
A new instance of FormattedText.
- #text ⇒ Object
Constructor Details
#initialize(text, options = {}) ⇒ FormattedText
Returns a new instance of FormattedText.
3 4 5 6 7 8 |
# File 'lib/rspec-live/formatted_text.rb', line 3 def initialize(text, = {}) @text = text @wrap = [:wrap] @width = [:width] @hanging_indent = [:hanging_indent] || 0 end |
Instance Method Details
#text ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rspec-live/formatted_text.rb', line 10 def text if @wrap wrap(@text, @width - @hanging_indent).split("\n").join("\n" + (" " * @hanging_indent)) else @text end end |