Class: PrettierPrint::IfBreakBuilder
- Inherits:
-
Object
- Object
- PrettierPrint::IfBreakBuilder
- Defined in:
- lib/prettier_print.rb
Overview
A small DSL-like object used for specifying the alternative contents to be printed if the surrounding group doesn’t break for an IfBreak node.
Instance Attribute Summary collapse
-
#flat_contents ⇒ Object
readonly
Returns the value of attribute flat_contents.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
Instance Method Summary collapse
- #if_flat ⇒ Object
-
#initialize(q, flat_contents) ⇒ IfBreakBuilder
constructor
A new instance of IfBreakBuilder.
Constructor Details
#initialize(q, flat_contents) ⇒ IfBreakBuilder
Returns a new instance of IfBreakBuilder.
877 878 879 880 |
# File 'lib/prettier_print.rb', line 877 def initialize(q, flat_contents) @q = q @flat_contents = flat_contents end |
Instance Attribute Details
#flat_contents ⇒ Object (readonly)
Returns the value of attribute flat_contents.
875 876 877 |
# File 'lib/prettier_print.rb', line 875 def flat_contents @flat_contents end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
875 876 877 |
# File 'lib/prettier_print.rb', line 875 def q @q end |
Instance Method Details
#if_flat ⇒ Object
882 883 884 |
# File 'lib/prettier_print.rb', line 882 def if_flat q.with_target(flat_contents) { yield } end |