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.



65
66
67
68
# File 'lib/Ice/Instrumentation.rb', line 65

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

Class Method Details

._enumeratorsObject



106
107
108
# File 'lib/Ice/Instrumentation.rb', line 106

def ThreadState._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



95
96
97
# File 'lib/Ice/Instrumentation.rb', line 95

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

.from_int(val) ⇒ Object



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

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

Instance Method Details

#<=>(other) ⇒ Object



82
83
84
85
# File 'lib/Ice/Instrumentation.rb', line 82

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

#hashObject



87
88
89
# File 'lib/Ice/Instrumentation.rb', line 87

def hash
    @value.hash
end

#inspectObject



91
92
93
# File 'lib/Ice/Instrumentation.rb', line 91

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

#to_iObject



78
79
80
# File 'lib/Ice/Instrumentation.rb', line 78

def to_i
    @value
end

#to_sObject



74
75
76
# File 'lib/Ice/Instrumentation.rb', line 74

def to_s
    @name
end