Class: Mirah::JavaSource::JsniMethodBuilder

Inherits:
MethodBuilder show all
Includes:
Helper
Defined in:
lib/mirah/plugin/gwt.rb

Instance Attribute Summary collapse

Attributes inherited from MethodBuilder

#klass

Instance Method Summary collapse

Methods included from Helper

#annotate, #annotation_value, #block, #dedent, #indent, #init_value, #print, #puts

Methods inherited from MethodBuilder

#declare_local, #instanceof, #label, #ldc_class, #ldc_double, #ldc_float, #ldc_long, #local?, #method_missing, #push_int, #returns_void?, #tmp

Constructor Details

#initialize(cls, options) ⇒ JsniMethodBuilder

Returns a new instance of JsniMethodBuilder.



39
40
41
# File 'lib/mirah/plugin/gwt.rb', line 39

def initialize(cls, options)
  super(cls, options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mirah::JavaSource::MethodBuilder

Instance Attribute Details

#nameObject

Returns the value of attribute name.



37
38
39
# File 'lib/mirah/plugin/gwt.rb', line 37

def name
  @name
end

#outObject

Returns the value of attribute out.



37
38
39
# File 'lib/mirah/plugin/gwt.rb', line 37

def out
  @out
end

#typeObject

Returns the value of attribute type.



37
38
39
# File 'lib/mirah/plugin/gwt.rb', line 37

def type
  @type
end

Instance Method Details

#startObject

Based on superclass’s method.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/mirah/plugin/gwt.rb', line 44

def start
  print "public#{@static} native #{@typename} #{@name}("
  @args.each_with_index do |(type, name), i|
    print ', ' unless i == 0
    print "#{type.to_source} #{name}"
  end
  print ')'
  unless @exceptions.empty?
    print ' throws '
    @exceptions.each_with_index do |exception, i|
      print ', ' unless i == 0
      print exception.name
    end
  end
  puts ' /*-{'
end

#stopObject

Based on superclass’s method.



62
63
64
# File 'lib/mirah/plugin/gwt.rb', line 62

def stop
  puts '}-*/;'
end