Class: Archipelago::Generators::IslandGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/archipelago/island/island_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_action_filesObject



17
18
19
20
21
22
# File 'lib/generators/archipelago/island/island_generator.rb', line 17

def create_action_files
  operations.each do |operation|
    @operation = operation
    template "action.rb.tt", File.join("app/islands", file_path, "#{operation}.rb")
  end
end

#create_component_fileObject



24
25
26
27
# File 'lib/generators/archipelago/island/island_generator.rb', line 24

def create_component_file
  @component_name = class_name
  template "component.tsx.tt", File.join("app/javascript/islands", "#{class_name}.tsx")
end

#ensure_operationsObject

Raises:

  • (ArgumentError)


13
14
15
# File 'lib/generators/archipelago/island/island_generator.rb', line 13

def ensure_operations
  raise ArgumentError, "At least one operation is required" if operations.empty?
end