Class: Rightscale::Slicehost::SlicesParser

Inherits:
RightSlicehostParser show all
Defined in:
lib/right_slicehost.rb

Overview


Slices


Constant Summary

Constants inherited from RightSlicehostParser

RightSlicehostParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from RightSlicehostParser

#result, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from RightSlicehostParser

#initialize, #method_missing, #parse, #tag_end, #tag_start, #tagtext, #text, xml_lib, xml_lib=

Constructor Details

This class inherits a constructor from Rightscale::RightSlicehostParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rightscale::RightSlicehostParser

Instance Method Details

#resetObject



537
538
539
# File 'lib/right_slicehost.rb', line 537

def reset
  @result = []
end

#tagend(name) ⇒ Object



518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/right_slicehost.rb', line 518

def tagend(name)
  case name
  when 'id'            then @item[:sls_id]        = @text.to_i
  when 'name'          then @item[:name]          = @text
  when 'image-id'      then @item[:image_sls_id]  = @text.to_i
  when 'flavor-id'     then @item[:flavor_sls_id] = @text.to_i
  when 'slice-id'      then @item[:slice_sls_id]  = @text.to_i
  when 'backup-id'     then @item[:backup_sls_id] = @text.to_i
  when 'status'        then @item[:status]        = @text
  when 'progress'      then @item[:progress]      = @text.to_i
  when 'bw-in'         then @item[:bw_in]         = @text.to_f
  when 'bw-out'        then @item[:bw_out]        = @text.to_f
  when 'ip-address'    then @item[:ip_address]    = @text
  when 'root-password' then @item[:root_password] = @text
  when 'address'       then @addresses           << @text
  when 'addresses'     then @item[:addresses]     = @addresses
  when 'slice'         then @result              << @item
  end
end

#tagstart(name, attributes) ⇒ Object

:nodoc:



514
515
516
517
# File 'lib/right_slicehost.rb', line 514

def tagstart(name, attributes)
  @item = {}      if name == 'slice'
  @addresses = [] if name == 'addresses'
end