Class: Awsum::Ec2::State

Inherits:
Object show all
Defined in:
lib/awsum/ec2/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, name) ⇒ State

Returns a new instance of State.



6
7
8
9
# File 'lib/awsum/ec2/state.rb', line 6

def initialize(code, name)
  @code = code.to_i
  @name = name
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/awsum/ec2/state.rb', line 4

def code
  @code
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/awsum/ec2/state.rb', line 4

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/awsum/ec2/state.rb', line 11

def ==(other)
  if other.is_a?(Numeric)
    @code == other
  elsif other.is_a?(String)
    @name == other
  else
    @code = other.code && @name == other.name
  end
end