Sha256: 59cd3abd418edc0ca776bd2c2ecb752a242a7a729986b39004821a6b45b1a31c

Contents?: true

Size: 689 Bytes

Versions: 7

Compression:

Stored size: 689 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]

  def render
    return super unless RUBY_EXTENSIONS.include? File.extname(self.destination)
    "# frozen_string_literal: true\n\n" + super
  end
end

Thor::Actions::CreateFile.prepend RailsGeneratorFrozenStringLiteralPrepend

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mobile_workflow-0.10.2 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.10.1 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.10.0 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.9.0 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.8.9 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.7.9 config/initializers/add_frozen_string_literal.rb
mobile_workflow-0.7.8 config/initializers/add_frozen_string_literal.rb