Class: PrettyPrint::Breakable
- Defined in:
- lib/extensions/mspec/mspec/pp.rb
Instance Attribute Summary collapse
-
#indent ⇒ Object
readonly
Returns the value of attribute indent.
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(sep, width, q) ⇒ Breakable
constructor
A new instance of Breakable.
- #output(out, output_width) ⇒ Object
Constructor Details
#initialize(sep, width, q) ⇒ Breakable
Returns a new instance of Breakable.
305 306 307 308 309 310 311 312 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 305 def initialize(sep, width, q) @obj = sep @width = width @pp = q @indent = q.indent @group = q.current_group @group.breakables.push self end |
Instance Attribute Details
#indent ⇒ Object (readonly)
Returns the value of attribute indent.
313 314 315 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 313 def indent @indent end |
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
313 314 315 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 313 def obj @obj end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
313 314 315 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 313 def width @width end |
Instance Method Details
#output(out, output_width) ⇒ Object
315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 315 def output(out, output_width) @group.breakables.shift if @group.break? out << @pp.newline out << @pp.genspace.call(@indent) @indent else @pp.group_queue.delete @group if @group.breakables.empty? out << @obj output_width + @width end end |