Templater::Generator
# File lib/merb-gen/generator.rb, line 32 32: def initialize(*args) 33: Merb::Config.setup({ 34: :log_level => :fatal, 35: :log_delimiter => " ~ ", 36: :log_auto_flush => false, 37: :reload_templates => false, 38: :reload_classes => false 39: }) 40: 41: Merb::BootLoader::Logger.run 42: Merb::BootLoader::BuildFramework.run 43: Merb::BootLoader::Dependencies.run 44: 45: super 46: options[:orm] ||= Merb.orm 47: options[:testing_framework] ||= Merb.test_framework 48: options[:template_engine] ||= Merb.template_engine 49: end
Returns a string of num times ’..’, useful for example in tests for namespaced generators to find the spec_helper higher up in the directory structure.
@param num
# File lib/merb-gen/generator.rb, line 73 73: def go_up(num) 74: (["'..'"] * num).join(', ') 75: end
Inside a template, wraps a block of code properly in modules, keeping the indentation correct
@param modules
# File lib/merb-gen/generator.rb, line 55 55: def with_modules(modules, options={}, &block) 56: indent = options[:indent] || 0 57: text = capture(&block) 58: modules.each_with_index do |mod, i| 59: concat((" " * (indent + i)) + "module #{mod}\n", block.binding) 60: end 61: text = Array(text).map{ |line| (" " * modules.size) + line }.join 62: concat(text, block.binding) 63: modules.reverse.each_with_index do |mod, i| 64: concat((" " * (indent + modules.size - i - 1)) + "end # #{mod}\n", block.binding) 65: end 66: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.