class AWS::InstMD::Treeish

Public Class Methods

new(http, prefix) click to toggle source
# File lib/aws/instmd.rb, line 20
def initialize http, prefix
  entries = InstMD.query http, prefix
  entries.lines.each do |l|
    l.chomp!
    if l.end_with? '/'
      self[l[0..-2]] = Treeish.new http, "#{prefix}#{l}"
    # meta-data/public-keys/ entries have a '0=foo' format
    elsif l =~ /(\d+)=(.*)/
      number, name = $1, $2
      self[name] = Treeish.new http, "#{prefix}#{number}/"
    else
      self[l] = InstMD.query http, "#{prefix}#{l}"
    end
  end
end