Class: Ice::Instrumentation::ThreadState

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

Constant Summary collapse

ThreadStateIdle =
ThreadState.new("ThreadStateIdle", 0)
ThreadStateInUseForIO =
ThreadState.new("ThreadStateInUseForIO", 1)
ThreadStateInUseForUser =
ThreadState.new("ThreadStateInUseForUser", 2)
ThreadStateInUseForOther =
ThreadState.new("ThreadStateInUseForOther", 3)
@@_enumerators =
{0=>ThreadStateIdle, 1=>ThreadStateInUseForIO, 2=>ThreadStateInUseForUser, 3=>ThreadStateInUseForOther}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ ThreadState

Returns a new instance of ThreadState.



34
35
36
37
# File 'lib/Ice/Instrumentation.rb', line 34

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

Class Method Details

._enumeratorsObject



71
72
73
# File 'lib/Ice/Instrumentation.rb', line 71

def ThreadState._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



60
61
62
# File 'lib/Ice/Instrumentation.rb', line 60

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

.from_int(val) ⇒ Object



39
40
41
# File 'lib/Ice/Instrumentation.rb', line 39

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

Instance Method Details

#<=>(other) ⇒ Object



51
52
53
54
# File 'lib/Ice/Instrumentation.rb', line 51

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

#hashObject



56
57
58
# File 'lib/Ice/Instrumentation.rb', line 56

def hash
    @value.hash
end

#to_iObject



47
48
49
# File 'lib/Ice/Instrumentation.rb', line 47

def to_i
    @value
end

#to_sObject



43
44
45
# File 'lib/Ice/Instrumentation.rb', line 43

def to_s
    @name
end