71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/codercompanion/java/java.rb', line 71
def build
els = []
privacy = ''
class_name = ''
inherits_from = ''
element_type = ''
implements = []
elements.each do |e|
if e.respond_to?(:class_qualifiers)
privacy = ::CoderCompanion::Java.(e.text_value)
end
if e.respond_to?(:class_or_enum)
element_type = e.text_value
next
end
if e.respond_to?(:class_name)
class_name = e.text_value
next
end
if e.respond_to?(:inheritance)
inherits_from = e.text_value.gsub(/extends\s+/, '')
inherits_from = inherits_from.gsub(/<.*>/, '')
next
end
if e.respond_to?(:implements)
implements = e.elements.first.build next
end
if e.respond_to?(:class_body)
els.concat(e.elements.first.build)
next
end
end
ret = {:type => "#{element_type}_definition", :value => class_name, :privacy => privacy, :inherits_from => inherits_from, :implements => implements, :class_elements => els}
return ret
end
|