method

wrap_in_modules

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: Rails::Generators::PluginGenerator
wrap_in_modules(unwrapped_code) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File railties/lib/rails/generators/rails/plugin/plugin_generator.rb, line 362
      def wrap_in_modules(unwrapped_code)
        unwrapped_code = "#{unwrapped_code}".strip.gsub(/\s$\n/, "")
        modules.reverse.inject(unwrapped_code) do |content, mod|
          str = +"module #{mod}\n"
          str << content.lines.map { |line| "  #{line}" }.join
          str << (content.present? ? "\nend" : "end")
        end
      end
Register or log in to add new notes.