class Ec2Meta::Api::Path

Attributes

prefix[R]

Public Class Methods

new(fetcher, prefix = []) click to toggle source
# File lib/ec2_meta/apis/path.rb, line 8
def initialize(fetcher, prefix = [])
  @_fetcher = fetcher
  @prefix = (prefix.is_a?(::String) ? [prefix] : prefix)
end

Private Instance Methods

fetch(path) click to toggle source
# File lib/ec2_meta/apis/path.rb, line 15
def fetch(path)
  fetcher.fetch(request_path(path))
end
fetcher() click to toggle source
# File lib/ec2_meta/apis/path.rb, line 28
def fetcher
  @_fetcher
end
new_prefix(part) click to toggle source
# File lib/ec2_meta/apis/path.rb, line 24
def new_prefix(part)
  prefix.dup << part
end
request_path(path) click to toggle source
# File lib/ec2_meta/apis/path.rb, line 19
def request_path(path)
  path_prefix = prefix.empty? ? '' : '/' + prefix.join('/')
  path_prefix + '/' + path
end