Class: Ec2ssh::Ec2Instances::InstanceWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2ssh/ec2_instances.rb

Defined Under Namespace

Classes: TagsWrapper

Instance Method Summary collapse

Constructor Details

#initialize(ec2_instance) ⇒ InstanceWrapper

Returns a new instance of InstanceWrapper.



35
36
37
38
# File 'lib/ec2ssh/ec2_instances.rb', line 35

def initialize(ec2_instance)
  @ec2_instance = ec2_instance
  @_tags ||= @ec2_instance.tags.each_with_object({}) {|t, h| h[t.key] = t.value }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



50
51
52
# File 'lib/ec2ssh/ec2_instances.rb', line 50

def method_missing(name, *args, &block)
  @ec2_instance.public_send(name, *args, &block)
end

Instance Method Details

#tag(key) ⇒ Object



40
41
42
# File 'lib/ec2ssh/ec2_instances.rb', line 40

def tag(key)
  @_tags[key]
end

#tagsObject



44
45
46
# File 'lib/ec2ssh/ec2_instances.rb', line 44

def tags
  TagsWrapper.new(super)
end