Sha256: b791a6861ec41e2ca4029d8342b94aa3c58ba9bbfd134e3de915b9ac4d8cb714

Contents?: true

Size: 653 Bytes

Versions: 8

Compression:

Stored size: 653 Bytes

Contents

# frozen_string_literal: true

require "rails/generators/erb/component_generator"

module Haml
  module Generators
    class ComponentGenerator < Erb::Generators::ComponentGenerator
      source_root File.expand_path("templates", __dir__)

      class_option :require_content, type: :boolean, default: false

      def copy_view_file
        template "component.html.haml", File.join("app/components", class_path, "#{file_name}_component.html.haml")
      end

      private

      def requires_content?
        options["require_content"]
      end

      def file_name
        @_file_name ||= super.sub(/_component\z/i, "")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
actionview-component-1.16.0 lib/rails/generators/haml/component_generator.rb
actionview-component-1.15.0 lib/rails/generators/haml/component_generator.rb
actionview-component-1.14.1 lib/rails/generators/haml/component_generator.rb
actionview-component-1.14.0 lib/rails/generators/haml/component_generator.rb
actionview-component-1.13.0 lib/rails/generators/haml/component_generator.rb
actionview-component-1.12.0 lib/rails/generators/haml/component_generator.rb
actionview-component-1.11.1 lib/rails/generators/haml/component_generator.rb
actionview-component-1.11.0 lib/rails/generators/haml/component_generator.rb