Class: GCEMetadata::Revision
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(path) ⇒ Revision
constructor
A new instance of Revision.
- #is_struct?(child_key) ⇒ Boolean
- #new_child(child_key) ⇒ Object
Methods inherited from Base
#child_keys, #children, #default_child, #from_hash, #get, #is_child_key?, #to_hash
Constructor Details
#initialize(path) ⇒ Revision
Returns a new instance of Revision.
5 6 7 8 |
# File 'lib/gce_metadata/revision.rb', line 5 def initialize(path) @path = path @default_child_key = 'v1/' end |
Instance Method Details
#is_struct?(child_key) ⇒ Boolean
18 19 20 |
# File 'lib/gce_metadata/revision.rb', line 18 def is_struct?(child_key) child_key =~ /\/$/ end |
#new_child(child_key) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/gce_metadata/revision.rb', line 10 def new_child(child_key) logging("new_child(#{child_key.inspect})") do child_path = "#{path}#{child_key}" child_path << '/' if (is_struct?(child_key) and not child_key.match(%r'/$')) Base.new(child_path) end end |