Class: EnumGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ModelGenerator/EnumGenerator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ EnumGenerator

Returns a new instance of EnumGenerator.



6
7
8
# File 'lib/ModelGenerator/EnumGenerator.rb', line 6

def initialize(args)
   @name_type_hash=args
end

Instance Attribute Details

#name_type_hashObject (readonly)

Returns the value of attribute name_type_hash.



4
5
6
# File 'lib/ModelGenerator/EnumGenerator.rb', line 4

def name_type_hash
  @name_type_hash
end

Instance Method Details

#generate_em_declareObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ModelGenerator/EnumGenerator.rb', line 10

def generate_em_declare
   content = ""
   @name_type_hash.each do |property_name,type_name|
     content << %Q/
typedef enum {
  <#enum_content#>
}#{type_name};/
   end
   if content.length > 0
     annotation = AnnotationGenerator.generate_single_annotation("emum declare")
     content = annotation + content
   end
   
   return content
end