Class: Rudy::AWS::EC2::Image

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

Constant Summary collapse

@@sformat =
"   -> %8s; %12s; %12s; %12s; %8s"

Instance Method Summary collapse

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


49
# File 'lib/rudy/aws/ec2/image.rb', line 49

def available?; @state && @state == "available"; end

#inspectObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/rudy/aws/ec2/image.rb', line 38

def inspect
  lines = []
  lines << liner_note
  field_names.each do |key|
    next unless self.respond_to?(key)
    val = self.send(key)
    lines << sprintf(" %22s: %s", key, (val.is_a?(Array) ? val.join(', ') : val))
  end
  lines.join($/)
end

#liner_noteObject



17
18
19
20
21
22
23
24
# File 'lib/rudy/aws/ec2/image.rb', line 17

def liner_note
  info = @location
  # Highlight "debian-5" in /dir/debian-5.manifest.xml
  #info = info.split(/\//) 
  #info[-1].gsub!(/(.+?)((\.img)?\.manifest\.xml)/) { |m,n| ($1 || "").bright << $2 }
  #info = info.join('/')
  "%s %-6s (%s)" % [self.awsid.bright, self.arch, info] 
end

#private?Boolean

Returns:

  • (Boolean)


51
# File 'lib/rudy/aws/ec2/image.rb', line 51

def private?; !public? end

#public?Boolean

Returns:

  • (Boolean)


50
# File 'lib/rudy/aws/ec2/image.rb', line 50

def public?; @visibility && @visibility == 'public'; end

#to_s(with_title = false) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rudy/aws/ec2/image.rb', line 26

def to_s(with_title=false)
  lines = []
  lines << liner_note
  #if self.available?
  #  p = public? ? "public" : "private" 
  #  k, r = @aki || 'aki-unknown', @ari || 'ari-unknown'
  #  lines << @@sformat % %w{arch owner aki ari visibility} if with_title
  #  lines << @@sformat % [@arch, @owner, k, r, p]
  #end
  lines.join($/)
end