Rails Ruby Pattern Generator. This gem allows to generate your design pattern through the rails generator.
rails generate pattern PATTERN_NAME
rails generate pattern MyCustomDecorator
Files generated:
app/decorators/application_decorator.rb
app/decorators/my_custom_decorator.rb
test/decorators/application_decoratior_test.rb
test/decorators/my_custom_decorator_test.rb
Add this line to your application's Gemfile:
gem 'pattern_bibz', group: :development
And then execute:
$ bundle
Or install it yourself as:
$ gem install pattern_bibz
To extend your Rails model generator:
$ rails g pattern_bibz:extend_model
Then you can generate your model:
$ rails g model MyModel title:string ...
Your generated model will look like this:
# frozen_string_literal: true
class MyModel < ApplicationRecord
# Scopes
# Constants
# Callbacks
# Attr_accessors
# Associations
# Enums
# Validations
# Delegations
# Methods
end
The gem is available as open source under the terms of the MIT License.