Class: Hotdog::Commands::Rm

Inherits:
BaseCommand show all
Defined in:
lib/hotdog/commands/rm.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#application, #formatter, #logger, #options, #tags

Instance Method Summary collapse

Methods inherited from BaseCommand

#execute, #initialize

Constructor Details

This class inherits a constructor from Hotdog::Commands::BaseCommand

Instance Method Details

#run(args = []) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/hotdog/commands/rm.rb', line 6

def run(args=[])
  execute(<<-EOS % args.map { "?" }.join(", "), args).map { |row| row.first }
    DELETE FROM hosts_tags
      WHERE host_id IN
        ( SELECT hosts_tags.host_id FROM hosts_tags
            INNER JOIN hosts ON hosts_tags.host_id = hosts.id
              WHERE hosts.name NOT IN (%s) );
  EOS
end