lib/rails/generators/mobility/translations_generator.rb in mobility-0.4.3 vs lib/rails/generators/mobility/translations_generator.rb in mobility-0.5.0
- old
+ new
@@ -33,11 +33,11 @@
a model table, which can be added with the normal Rails migration generator.
=end
class TranslationsGenerator < ::Rails::Generators::NamedBase
SUPPORTED_BACKENDS = %w[column table]
- BACKEND_OPTIONS = { type: :string, desc: "Backend to use for translations (defaults to Mobility.default_backend)".freeze }
+ BACKEND_OPTIONS = { type: :string, desc: "Backend to use for translations (defaults to Mobility.default_backend)" }
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
class_option(:backend, BACKEND_OPTIONS)
invoke_from_option :backend
@@ -48,11 +48,11 @@
end
def self.prepare_for_invocation(name, value)
if name == :backend
if SUPPORTED_BACKENDS.include?(value)
- require_relative "./backend_generators/#{value}_backend".freeze
+ require_relative "./backend_generators/#{value}_backend"
Mobility::BackendGenerators.const_get("#{value}_backend".camelcase.freeze)
else
begin
require "mobility/backends/#{value}"
raise Thor::Error, "The #{value} backend does not have a translations generator."
@@ -68,10 +68,10 @@
protected
def say_status(status, message, *args)
if status == :invoke && SUPPORTED_BACKENDS.include?(message)
- super(status, "#{message}_backend".freeze, *args)
+ super(status, "#{message}_backend", *args)
else
super
end
end
end