Module: Duby::JavaSource::Helper
- Included in:
- ClassBuilder, MethodBuilder
- Defined in:
- lib/duby/jvm/source_generator/builder.rb
Instance Method Summary collapse
- #block(line = '') ⇒ Object
- #dedent ⇒ Object
- #indent ⇒ Object
- #init_value(type) ⇒ Object
- #print(*args) ⇒ Object
- #puts(*args) ⇒ Object
Instance Method Details
#block(line = '') ⇒ Object
105 106 107 108 109 110 111 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 105 def block(line='') puts line + " {" indent yield dedent puts "}" end |
#dedent ⇒ Object
101 102 103 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 101 def dedent @out.dedent end |
#indent ⇒ Object
97 98 99 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 97 def indent @out.indent end |
#init_value(type) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 113 def init_value(type) # TODO move this to types? case type when JVMTypes::Boolean 'false' when JVMTypes::PrimitiveType, JVMTypes::NarrowingType '0' else 'null' end end |
#print(*args) ⇒ Object
93 94 95 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 93 def print(*args) @out.print(*args) end |
#puts(*args) ⇒ Object
89 90 91 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 89 def puts(*args) @out.puts(*args) end |