Class: Rudy::AWS::EC2::Volume

Inherits:
Storable
  • Object
show all
Defined in:
lib/rudy/aws/ec2/volume.rb

Constant Summary collapse

@@sformat =

cram the terabyte

"%s  %10s;%4sGB;  %s  "

Instance Method Summary collapse

Instance Method Details

#attached?Boolean

Returns:

  • (Boolean)


45
# File 'lib/rudy/aws/ec2/volume.rb', line 45

def attached?; (status && status == "attached"); end

#available?Boolean

Returns:

  • (Boolean)


42
# File 'lib/rudy/aws/ec2/volume.rb', line 42

def available?; (status && status == "available"); end

#creating?Boolean

Returns:

  • (Boolean)


43
# File 'lib/rudy/aws/ec2/volume.rb', line 43

def creating?; (status && status == "creating"); end

#deleting?Boolean

Returns:

  • (Boolean)


44
# File 'lib/rudy/aws/ec2/volume.rb', line 44

def deleting?; (status && status == "deleting"); end

#in_use?Boolean

Returns:

  • (Boolean)


46
# File 'lib/rudy/aws/ec2/volume.rb', line 46

def in_use?; (status && status == "in-use"); end

#inspectObject



29
30
31
32
33
34
35
# File 'lib/rudy/aws/ec2/volume.rb', line 29

def inspect
  lines = [liner_note]
  field_names.each do |n|
     lines << sprintf(" %12s:  %s", n, self.send(n)) if self.send(n)
   end
  lines.join($/)
end

#liner_noteObject



18
19
20
21
# File 'lib/rudy/aws/ec2/volume.rb', line 18

def liner_note
  info = attached? ? "attached to #{@instid}" : @status
  "%s (%s)" % [(self.awsid || '').bright, info]
end

#stateObject

Alias for status



38
39
40
# File 'lib/rudy/aws/ec2/volume.rb', line 38

def state
  status
end

#to_s(with_title = false) ⇒ Object



23
24
25
26
27
# File 'lib/rudy/aws/ec2/volume.rb', line 23

def to_s(with_title=false)
  line = @@sformat % [liner_note, @zone, @size, @device]
  line << " <- %s" % [@snapid] if @snapid
  line
end