Class: PrettyPrint::IfBreakBuilder
- Inherits:
-
Object
- Object
- PrettyPrint::IfBreakBuilder
- Defined in:
- lib/syntax_tree/prettyprint.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
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#if_break ⇒ Object
readonly
Returns the value of attribute if_break.
Instance Method Summary collapse
- #if_flat(&block) ⇒ Object
-
#initialize(builder, if_break) ⇒ IfBreakBuilder
constructor
A new instance of IfBreakBuilder.
Constructor Details
#initialize(builder, if_break) ⇒ IfBreakBuilder
Returns a new instance of IfBreakBuilder.
987 988 989 990 |
# File 'lib/syntax_tree/prettyprint.rb', line 987 def initialize(builder, if_break) @builder = builder @if_break = if_break end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
985 986 987 |
# File 'lib/syntax_tree/prettyprint.rb', line 985 def builder @builder end |
#if_break ⇒ Object (readonly)
Returns the value of attribute if_break.
985 986 987 |
# File 'lib/syntax_tree/prettyprint.rb', line 985 def if_break @if_break end |
Instance Method Details
#if_flat(&block) ⇒ Object
992 993 994 |
# File 'lib/syntax_tree/prettyprint.rb', line 992 def if_flat(&block) builder.with_target(if_break.flat_contents, &block) end |