Top Level Namespace

Includes:
StringManip

Defined Under Namespace

Modules: Header, JavaKlass, JavaMethod, JavaProperty, RubyKlass, RubyMethod, RubyProperty, StringManip, Ycn Classes: Klass, Methodd, Property

Instance Method Summary collapse

Methods included from StringManip

#camel_case, #camelize, #low_camelize, #styled_var

Instance Method Details

#attribute_hash_to_class(class_name, attribute_hash) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ycn/ycn_functions.rb', line 26

def attribute_hash_to_class class_name, attribute_hash
  inheritance = check_for_inheritance(class_name)
  name        = inheritance[:name]
  parent      = inheritance[:parent]
  properties  = attribute_hash['properties']
  methods     = attribute_hash['methods']
  new_params  = attribute_hash['new']
  package     = configatron.package
  
  Klass.new(name, parent, properties, methods, new_params, package)
end

#check_for_inheritance(class_name) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/ycn/ycn_functions.rb', line 10

def check_for_inheritance class_name
  if class_name =~ /.+<.+/
    klass = class_name.split(/\s*<\s*/)
    return {:name => klass[0], :parent => klass[1]}
  else
    return {:name => class_name}
  end
end

#correct_for_blank_last_method(file) ⇒ Object

~ require ‘property’



3
4
5
6
7
8
# File 'lib/ycn/ycn_functions.rb', line 3

def correct_for_blank_last_method file
  # Without this, a blank mapping on the last line of the file
  # is incorrectly interpreted as a String.
  content = file.read
  content += "\n"
end

#extensionObject



38
39
40
# File 'lib/ycn/ycn_functions.rb', line 38

def extension
  {:java => 'java', :ruby => 'rb'}
end

#fix_inheritance_and_overrides(classes) ⇒ Object



19
20
21
22
23
24
# File 'lib/ycn/ycn_functions.rb', line 19

def fix_inheritance_and_overrides classes
  classes.each { |klass|
    klass.parent = (classes.find_all{ |c| c.name == klass.parent })[0]
  }.each { |klass|
    klass.fix_default_overrides }
end