Sha256: 0d42a26e5e8442de91ed63469b59a268c714aeb0d5cc2aecf859ad989c088a5a
Contents?: true
Size: 582 Bytes
Versions: 1
Compression:
Stored size: 582 Bytes
Contents
# frozen_string_literal: true require 'rails/generators' module Rails class QueryGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) check_class_collision suffix: 'Query' hook_for :test_framework def create_query path = File.join('app', 'queries', class_path, "#{file_name}_query.rb") template('query.rb.tt', path) end private def file_name @_file_name ||= remove_possible_suffix(super) end def remove_possible_suffix(name) name.sub(/_?query$/i, '') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lite-query-1.0.0 | lib/generators/rails/query_generator.rb |