Class: Utter::Generators::Ext

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/generators/generators.rb

Instance Method Summary collapse

Instance Method Details

#create_ext(params = {}) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/generators/generators.rb', line 61

def create_ext params={}
  @module_name = params[:module_name].downcase
  @ext_name = params[:ext_name].downcase

  create_file "domain/lib/#{@ext_name.downcase}.rb"
  @file = "module \#{@module_name.capitalize}\n  VERSION = \"0.0.0\"\n  class \#{@ext_name.capitalize} \n    def initialize(app, opts={}, params={})\n@app  = app\n@opts   = opts \n@params   = params \n    end\n\n    def call(env)\n#TODO manipulate value objects, before passing to the stack!\[email protected](env)\n#TODO manipulate value objects, after passing to the stack!\n    end\n  end\nend\n  FOO\n\n  open(\"domain/lib/\#{@ext_name.downcase}.rb\", 'a') do |f|\n    f.puts @file\n  end\nend\n"