Module: RubyKlass

Defined in:
lib/ycn/ruby/ruby_klass.rb

Instance Method Summary collapse

Instance Method Details

#ruby_accessorsObject

~ end



66
# File 'lib/ycn/ruby/ruby_klass.rb', line 66

def ruby_accessors; ruby_g_s_etters; end

#ruby_class_declarationObject



35
36
37
# File 'lib/ycn/ruby/ruby_klass.rb', line 35

def ruby_class_declaration
  "class #{name}#{" < #{parent.name}" if parent}"
end

#ruby_constructorsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ycn/ruby/ruby_klass.rb', line 39

def ruby_constructors
  #~ @construct_params.map { |parameter_set|
    #~ "\n  public #{@name}(" +
    
    #~ parameter_set.map { |parameter|
      #~ type = find_var( parameter ).type
      #~ "#{type} #{styled_var :riki, parameter, :p, type}"
      
    #~ }.join(', ') + ")\n  {\n    " +
    
    #~ parameter_set.map { |parameter|
      #~ type = find_var( parameter ).type
      #~ "set#{camelize parameter}(#{styled_var :riki, parameter, :p, type});"
    #~ }.join("\n    ") +
    
    #~ java_prop_default_overrides
  #~ }.join("\n  }\n") + "\n  }\n"
  "def initialize " + @construct_params.last.join(', ')
end

#ruby_g_s_ettersObject



68
69
70
# File 'lib/ycn/ruby/ruby_klass.rb', line 68

def ruby_g_s_etters
  "attr_accessor #{@properties.map{|p| ":#{p.name}"}.join(', ')}\n"
end

#ruby_headerObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ycn/ruby/ruby_klass.rb', line 4

def ruby_header 
  text = <<HEAD
Programme :    #{configatron.program_name}
Auteur(s) :    #{configatron.author_name}
Date :         #{Time.now.day}/#{Time.now.month}/#{Time.now.year}
Description :  #{configatron.description}
HEAD

  text.split("\n").map{ |l|
    "# #{l}\n"
  }.join
end

#ruby_importsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ycn/ruby/ruby_klass.rb', line 17

def ruby_imports
  #~ text = properties.map{ |property|
    #~ import = case property.type
      #~ when 'Date'
        #~ "import java.util.Date;"
      #~ when 'Time'
        #~ "import java.util.Time;"
      #~ else
        #~ nil
    #~ end
    #~ import  
  #~ }.compact
  
  #~ if text.size > 0
    #~ text = "\n" + text.join("\n")  + "\n"
  #~ end
end