Sha256: cea0fbd4704a06cd399c3ce5b39c0e78c3e3dd00a060cc267fe6c9cb24ba98a9

Contents?: true

Size: 692 Bytes

Versions: 5

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

# Adds a `frozen_string_literal` comment to the top of files created by Rails generators.
# Taken from https://gist.github.com/thornomad/4e2f0905e2a4a6eefbc4be5772dfd4f7#gistcomment-3533276
#
# Warning! Doorkeeper auto generated files already include `frozen_string_literal`, so it will be duplicated.

return unless defined?(::Rails::Generators)

module RailsGeneratorFrozenStringLiteralPrepend
  RUBY_EXTENSIONS = %w[.rb .rake].freeze

  def render
    return super unless RUBY_EXTENSIONS.include? File.extname(destination)

    "# frozen_string_literal: true\n\n#{super}"
  end
end

Thor::Actions::CreateFile.prepend RailsGeneratorFrozenStringLiteralPrepend

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mobile_workflow-0.12.2 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.12.1 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.12.0 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.11.1 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.11.0 config/initializers/add_frozen_string_literal.rb