Top Level Namespace
Defined Under Namespace
Modules: AntwrapClassLoader, ApacheAnt, JavaLang Classes: AntProject, AntTask
Constant Summary collapse
- @@reserved_words =
['alias', 'and', 'BEGIN', 'begin', 'break', 'case', 'class', 'def', 'defined', 'do', 'else', 'elsif', 'END', 'end', 'ensure', 'false', 'for', 'if', 'in', 'module', 'next', 'nil', 'not', 'or', 'redo', 'rescue', 'retry', 'return', 'self', 'super', 'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield', 'java']
Instance Method Summary collapse
- #create_symbol(str) ⇒ Object
- #print_task(task, tab = @one_tab, prefix = '') ⇒ Object
- #rubyize(str) ⇒ Object
Instance Method Details
#create_symbol(str) ⇒ Object
26 27 28 29 |
# File 'lib/convert.rb', line 26 def create_symbol(str) str = rubyize(str) return str.gsub(/(\w*[^,\s])/, ':\1') end |
#print_task(task, tab = @one_tab, prefix = '') ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/convert.rb', line 46 def print_task(task, tab=@one_tab, prefix='') task_name = rubyize(task.name) @rakefile.print "#{tab}#{prefix}#{task_name}(" if(task_name == 'macrodef') task.attributes['name'] = rubyize(task.attributes['name']) elsif(task_name == 'java') task_name = 'jvm' end isFirst = true; task.attributes.each do |key, value| if !isFirst @rakefile.print(",\n#{tab+@one_tab}") end @rakefile.print ":#{key} => \"#{value}\"" isFirst = false; end if task.has_text? pcdata = task.texts().join if(pcdata.strip() != '') @rakefile.print ":pcdata => \"#{pcdata}\"" end end @rakefile.print ")" if task.elements.size > 0 @rakefile.print "{" task.elements.each do |child| @rakefile.print "\n" print_task(child, (tab+@one_tab), '') end @rakefile.print "\n#{tab}}" end end |
#rubyize(str) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/convert.rb', line 31 def rubyize(str) if (str == nil) str = '' elsif (@@reserved_words.index(str) != nil) str = '_' + str else str = str.gsub(/(\w*)[\-|\.](\w*)/, '\1_\2') end return str end |