Class: Duby::JavaSource::Builder
- Inherits:
-
Object
- Object
- Duby::JavaSource::Builder
- Defined in:
- lib/duby/jvm/source_generator/builder.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
Returns the value of attribute classes.
-
#compiler ⇒ Object
Returns the value of attribute compiler.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#package ⇒ Object
Returns the value of attribute package.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(filename, compiler) ⇒ Builder
constructor
A new instance of Builder.
- #public_class(name, superclass = nil, *interfaces) ⇒ Object
- #public_interface(name, *interfaces) ⇒ Object
Constructor Details
#initialize(filename, compiler) ⇒ Builder
Returns a new instance of Builder.
18 19 20 21 22 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 18 def initialize(filename, compiler) @filename = filename @classes = [] @compiler = compiler end |
Instance Attribute Details
#classes ⇒ Object
Returns the value of attribute classes.
16 17 18 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 16 def classes @classes end |
#compiler ⇒ Object
Returns the value of attribute compiler.
16 17 18 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 16 def compiler @compiler end |
#filename ⇒ Object
Returns the value of attribute filename.
16 17 18 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 16 def filename @filename end |
#package ⇒ Object
Returns the value of attribute package.
16 17 18 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 16 def package @package end |
Instance Method Details
#generate ⇒ Object
36 37 38 39 40 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 36 def generate @classes.each do |cls| yield cls.filename, cls end end |
#public_class(name, superclass = nil, *interfaces) ⇒ Object
24 25 26 27 28 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 24 def public_class(name, superclass=nil, *interfaces) cls = ClassBuilder.new(self, name, superclass, interfaces) @classes << cls cls end |
#public_interface(name, *interfaces) ⇒ Object
30 31 32 33 34 |
# File 'lib/duby/jvm/source_generator/builder.rb', line 30 def public_interface(name, *interfaces) cls = InterfaceBuilder.new(self, name, interfaces) @classes << cls cls end |