Class: PrettyPrint::IfBreakBuilder

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(builder, if_break) ⇒ IfBreakBuilder

Returns a new instance of IfBreakBuilder.



975
976
977
978
# File 'lib/syntax_tree/prettyprint.rb', line 975

def initialize(builder, if_break)
  @builder = builder
  @if_break = if_break
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



973
974
975
# File 'lib/syntax_tree/prettyprint.rb', line 973

def builder
  @builder
end

#if_breakObject (readonly)

Returns the value of attribute if_break.



973
974
975
# File 'lib/syntax_tree/prettyprint.rb', line 973

def if_break
  @if_break
end

Instance Method Details

#if_flat(&block) ⇒ Object



980
981
982
# File 'lib/syntax_tree/prettyprint.rb', line 980

def if_flat(&block)
  builder.with_target(if_break.flat_contents, &block)
end