Class: NimbusGenerator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ NimbusGenerator

Returns a new instance of NimbusGenerator.



8
9
10
11
12
13
14
# File 'lib/ModelGenerator/NimbusGenerator.rb', line 8

def initialize(command)
   @commandTask=command
   @method_generator=MethodGenerator.new(command)
   if !@commandTask.primary_key && @commandTask.flags.join.include?("d")
      raise "error : you must set table primary key"
   end
end

Instance Attribute Details

#commandTaskObject (readonly)

Returns the value of attribute commandTask.



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

def commandTask
  @commandTask
end

Instance Method Details

#generate_cell_class_methodObject



28
29
30
31
32
33
34
# File 'lib/ModelGenerator/NimbusGenerator.rb', line 28

def generate_cell_class_method
  if @commandTask.flags.join.include?("n")
    return @method_generator.generate_method("-","Class","cellClass","return <#CellClass#>;",false);
  end

       return ""
end

#generate_cell_style_methodObject



36
37
38
39
40
41
42
# File 'lib/ModelGenerator/NimbusGenerator.rb', line 36

def generate_cell_style_method
  if @commandTask.flags.join.include?("n")
    return @method_generator.generate_method("-","UITableViewCellStyle","cellStyle","return <#CellStyle#>;",false);
  end

       return ""
end

#generate_need_methodsObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ModelGenerator/NimbusGenerator.rb', line 16

def generate_need_methods
  content = ""
  if !self.generate_cell_class_method.empty?  || !self.generate_cell_style_method.empty?
    content << AnnotationGenerator.generate_mark_annotation("Nimbus method")
  content << self.generate_cell_class_method
          content << "\n"
  content << self.generate_cell_style_method
  end

      return content
end