lib/generators/hyrax/work/work_generator.rb in hyrax-3.0.0.pre.rc1 vs lib/generators/hyrax/work/work_generator.rb in hyrax-3.0.0.pre.rc2

- old
+ new

@@ -1,5 +1,6 @@ +# frozen_string_literal: true require 'rails/generators' require 'rails/generators/model_helpers' class Hyrax::WorkGenerator < Rails::Generators::NamedBase # ActiveSupport can interpret models as plural which causes @@ -57,11 +58,11 @@ def register_work config = 'config/initializers/hyrax.rb' lastmatch = nil in_root do File.open(config).each_line do |line| - lastmatch = line if line =~ /config.register_curation_concern :(?!#{file_name})/ + lastmatch = line if line.match?(/config.register_curation_concern :(?!#{file_name})/) end content = " # Injected via `rails g hyrax:work #{class_name}`\n" \ " config.register_curation_concern #{registration_path_symbol}\n" anchor = lastmatch || "Hyrax.config do |config|\n" inject_into_file config, after: anchor do @@ -112,21 +113,21 @@ readme 'README' unless revoking? end private - def rspec_installed? - defined?(RSpec) && defined?(RSpec::Rails) - end + def rspec_installed? + defined?(RSpec) && defined?(RSpec::Rails) + end - def revoking? - behavior == :revoke - end + def revoking? + behavior == :revoke + end - def registration_path_symbol - return ":#{file_name}" if class_path.blank? - # this next line creates a symbol with a path like - # "abc/scholarly_paper" where abc is the namespace and - # scholarly_paper is the concern - ":\"#{File.join(class_path, file_name)}\"" - end + def registration_path_symbol + return ":#{file_name}" if class_path.blank? + # this next line creates a symbol with a path like + # "abc/scholarly_paper" where abc is the namespace and + # scholarly_paper is the concern + ":\"#{File.join(class_path, file_name)}\"" + end end