Top Level Namespace
Defined Under Namespace
Modules: Kernel, Waves Classes: Cassy, Float, Hash, Integer, Module, Object, String, Symbol, Tempfile, Time
Instance Method Summary collapse
-
#app_name ⇒ Object
Helper methods.
-
#basetask(str) ⇒ Object
Rake only pretends to namespace tasks, so to get what we think of as the task name, you must split and grab.
- #class_template(app_name, place, class_name) ⇒ Object
- #constant_name ⇒ Object
- #filename(kind) ⇒ Object
-
#module_template(app_name, place, module_name, &block) ⇒ Object
This method expects its block to return something usable as a string.
Methods included from Waves::Foundations::REST::ConvenienceMethods
Instance Method Details
#app_name ⇒ Object
Helper methods
37 38 39 |
# File 'lib/waves/tasks/generate.rb', line 37 def app_name ( ENV['app'] || Dir.pwd.split('/').last ).camel_case end |
#basetask(str) ⇒ Object
Rake only pretends to namespace tasks, so to get what we think of as the task name, you must split and grab.
58 59 60 |
# File 'lib/waves/tasks/generate.rb', line 58 def basetask(str) str.split(":").last end |
#class_template(app_name, place, class_name) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/waves/tasks/generate.rb', line 62 def class_template(app_name, place, class_name) str = "module \#{app_name}\n module \#{place}\n class \#{class_name} < Default\n\n end\n end\nend\n" end |
#constant_name ⇒ Object
41 42 43 44 45 |
# File 'lib/waves/tasks/generate.rb', line 41 def constant_name str = ENV['name'].camel_case raise "Cannot generate Default yet" if str == 'Default' str end |
#filename(kind) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/waves/tasks/generate.rb', line 47 def filename( kind ) path = File. "#{kind}/#{ENV['name'].snake_case}.rb" if File.exist?(path) $stderr.puts " Problem encountered:\n #{path} already exists" exit end path end |
#module_template(app_name, place, module_name, &block) ⇒ Object
This method expects its block to return something usable as a string.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/waves/tasks/generate.rb', line 75 def module_template(app_name, place, module_name, &block) str = "module \#{app_name}\n module \#{place}\n module \#{module_name}\n \#{block.call if block}\n end\n end\nend\n" end |