Class: PolarBear::Command::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/polarbear/command/batch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ Batch

Returns a new instance of Batch.



32
33
34
35
36
37
38
39
# File 'lib/polarbear/command/batch.rb', line 32

def initialize (options = nil)
  options = GlobalOptions.new if options == nil

  @command = {}
  @command[':batch-commands'] = {}
  @command[':batch-commands'][:'global-options'] = options.to_hash
  @command[':batch-commands'].compare_by_identity
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



30
31
32
# File 'lib/polarbear/command/batch.rb', line 30

def command
  @command
end

Instance Method Details

#add_command(command_name, hash) ⇒ Object



41
42
43
# File 'lib/polarbear/command/batch.rb', line 41

def add_command(command_name, hash)
  @command[':batch-commands'][":#{command_name}"] = hash
end

#executeObject



45
46
47
# File 'lib/polarbear/command/batch.rb', line 45

def execute
  Admin.new.execute_batch(Gyoku.xml(@command))
end