Class: Maglev::Sections::RemoveCommand

Inherits:
Rails::Command::Base
  • Object
show all
Defined in:
lib/commands/maglev/sections/remove_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



10
11
12
# File 'lib/commands/maglev/sections/remove_command.rb', line 10

def self.banner
  'bin/rails maglev:sections:remove TYPE'
end

Instance Method Details

#perform(type) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/commands/maglev/sections/remove_command.rb', line 14

def perform(type)
  require File.expand_path('config/environment', Rails.root)

  site = fetch_site

  return if site.blank?

  removed_count = Maglev::RemoveSectionType.call(
    site: site,
    type: type
  )

  display_final_message(removed_count, type)
end