Class: Reactor::Plans::DeleteChannel

Inherits:
CommonChannel show all
Defined in:
lib/reactor/plans/delete_channel.rb

Constant Summary

Constants inherited from CommonChannel

CommonChannel::ALLOWED_PARAMS

Instance Method Summary collapse

Methods inherited from CommonChannel

#set

Methods included from Prepared

#error, #separate_arguments

Constructor Details

#initialize(*args) ⇒ DeleteChannel

Returns a new instance of DeleteChannel.



6
7
8
9
10
# File 'lib/reactor/plans/delete_channel.rb', line 6

def initialize(*args)
  super()
  (name, x), options = separate_arguments(*args)
  @name = name || options[:name]
end

Instance Method Details

#migrate!Object



17
18
19
# File 'lib/reactor/plans/delete_channel.rb', line 17

def migrate!
  Reactor::Cm::Channel.get(@name).delete!
end

#prepare!Object



12
13
14
15
# File 'lib/reactor/plans/delete_channel.rb', line 12

def prepare!
  error("name is nil") if @name.nil?
  error("channel #{@name} does not exist") unless Reactor::Cm::Channel.exists?(@name)
end