class Motion::Generators::ComponentGenerator

Public Instance Methods

generate_component() click to toggle source
# File lib/generators/motion/component_generator.rb, line 12
def generate_component
  generate "component", class_name, *attributes.map(&:name)
end
include_motion() click to toggle source
# File lib/generators/motion/component_generator.rb, line 16
def include_motion
  inject_into_class component_path, "#{class_name}Component" do
    "  include Motion::Component\n\n"
  end
end

Private Instance Methods

component_path() click to toggle source
# File lib/generators/motion/component_generator.rb, line 24
def component_path
  @component_path ||=
    File.join("app/components", class_path, "#{file_name}_component.rb")
end
file_name() click to toggle source
Calls superclass method
# File lib/generators/motion/component_generator.rb, line 29
def file_name
  @_file_name ||= super.sub(/_component\z/i, "")
end