Class: Guff::JavaSource::Body
- Inherits:
-
Object
- Object
- Guff::JavaSource::Body
- Defined in:
- lib/guff/java_source.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #append(t) ⇒ Object
- #body {|nested| ... } ⇒ Object
-
#initialize ⇒ Body
constructor
A new instance of Body.
- #line(l) ⇒ Object
- #write_to(writer) ⇒ Object
Constructor Details
#initialize ⇒ Body
Returns a new instance of Body.
345 346 347 |
# File 'lib/guff/java_source.rb', line 345 def initialize @bits = [] end |
Class Method Details
.default_body ⇒ Object
341 342 343 |
# File 'lib/guff/java_source.rb', line 341 def self.default_body EmptyBody.new end |
Instance Method Details
#append(t) ⇒ Object
354 355 356 357 |
# File 'lib/guff/java_source.rb', line 354 def append(t) @bits << BodyBits::Text.new(t) self end |
#body {|nested| ... } ⇒ Object
359 360 361 362 363 364 |
# File 'lib/guff/java_source.rb', line 359 def body nested = Body.new @bits << BodyBits::NestedBody.new(nested) yield nested self end |
#line(l) ⇒ Object
349 350 351 352 |
# File 'lib/guff/java_source.rb', line 349 def line(l) @bits << BodyBits::Line.new(l) self end |
#write_to(writer) ⇒ Object
366 367 368 369 370 371 372 |
# File 'lib/guff/java_source.rb', line 366 def write_to(writer) writer.open_brace @bits.each {|bit| bit.write_to(writer) } writer.close_brace end |