Class: AwsRo::EC2::Instance

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
KeyValueAccessible
Defined in:
lib/aws_ro/ec2/instance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from KeyValueAccessible

tag_separator, tag_separator=

Constructor Details

#initialize(ec2_instance) ⇒ Instance

Returns a new instance of Instance.



17
18
19
20
21
22
23
24
# File 'lib/aws_ro/ec2/instance.rb', line 17

def initialize(ec2_instance)
  @ec2_instance = ec2_instance
  if @ec2_instance.respond_to?(:tags)
    tags = format_ec2_tags(@ec2_instance.tags)
    define_custom_accessors_unless_conflict(tags)
    @tags = Struct.new(*tags.keys)[*tags.values] unless tags.empty?
  end
end

Instance Attribute Details

#ec2_instanceObject (readonly) Also known as: ec2

Returns the value of attribute ec2_instance.



10
11
12
# File 'lib/aws_ro/ec2/instance.rb', line 10

def ec2_instance
  @ec2_instance
end

#tagsObject (readonly)

Returns the value of attribute tags.



10
11
12
# File 'lib/aws_ro/ec2/instance.rb', line 10

def tags
  @tags
end

Instance Method Details

#running?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/aws_ro/ec2/instance.rb', line 26

def running?
  state.name == 'running'
end