Sha256: 144e0442ec4079a930c1bedc101893d6c3ed66eff7a33d96fe7fd1e2944c25c7
Contents?: true
Size: 926 Bytes
Versions: 1
Compression:
Stored size: 926 Bytes
Contents
module Rails module Generators class DecoratorGenerator < NamedBase source_root File.expand_path("../templates", __FILE__) check_class_collision :suffix => "Decorator" class_option :parent, :type => :string, :desc => "The parent class for the generated decorator" desc <<DESC Description: Stubs out a decorator class in app/decorators directory. Examples: `rails g decorator book` This creates: app/decorators/book_decorator.rb DESC def create_decorator_file template 'decorator.rb', File.join('app/decorators', class_path, "#{file_name}_decorator.rb") end hook_for :test_framework private def parent_class_name if options[:parent] options[:parent] elsif defined?(ApplicationDecorator) "ApplicationDecorator" else "RDecorator::Decorator" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
r_decorator-0.0.1 | lib/generators/decorator/decorator_generator.rb |