Class: Ice::ACMHeartbeat

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/Ice/Connection.rb

Constant Summary collapse

HeartbeatOff =
ACMHeartbeat.new("HeartbeatOff", 0)
HeartbeatOnInvocation =
ACMHeartbeat.new("HeartbeatOnInvocation", 1)
HeartbeatOnIdle =
ACMHeartbeat.new("HeartbeatOnIdle", 2)
HeartbeatAlways =
ACMHeartbeat.new("HeartbeatAlways", 3)
@@_enumerators =
{0=>HeartbeatOff, 1=>HeartbeatOnInvocation, 2=>HeartbeatOnIdle, 3=>HeartbeatAlways}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ ACMHeartbeat

Returns a new instance of ACMHeartbeat.



161
162
163
164
# File 'lib/Ice/Connection.rb', line 161

def initialize(name, value)
    @name = name
    @value = value
end

Class Method Details

._enumeratorsObject



202
203
204
# File 'lib/Ice/Connection.rb', line 202

def ACMHeartbeat._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



191
192
193
# File 'lib/Ice/Connection.rb', line 191

def ACMHeartbeat.each(&block)
    @@_enumerators.each_value(&block)
end

.from_int(val) ⇒ Object



166
167
168
# File 'lib/Ice/Connection.rb', line 166

def ACMHeartbeat.from_int(val)
    @@_enumerators[val]
end

Instance Method Details

#<=>(other) ⇒ Object



178
179
180
181
# File 'lib/Ice/Connection.rb', line 178

def <=>(other)
    other.is_a?(ACMHeartbeat) or raise ArgumentError, "value must be a ACMHeartbeat"
    @value <=> other.to_i
end

#hashObject



183
184
185
# File 'lib/Ice/Connection.rb', line 183

def hash
    @value.hash
end

#inspectObject



187
188
189
# File 'lib/Ice/Connection.rb', line 187

def inspect
    @name + "(#{@value})"
end

#to_iObject



174
175
176
# File 'lib/Ice/Connection.rb', line 174

def to_i
    @value
end

#to_sObject



170
171
172
# File 'lib/Ice/Connection.rb', line 170

def to_s
    @name
end