Exception: Qpid::Proton::Condition
- Inherits:
-
ProtonError
- Object
- RuntimeError
- ProtonError
- Qpid::Proton::Condition
- Defined in:
- lib/core/condition.rb
Overview
Instance Attribute Summary collapse
- #description readonly
- #info readonly
- #name readonly
Class Method Summary collapse
-
.convert(obj, default_name = "error") ⇒ Condition
Convert an object to a condition.
Instance Method Summary collapse
- #==(other)
-
#initialize(name, description = nil, info = nil) ⇒ Condition
constructor
A new instance of Condition.
- #inspect
- #to_s
Constructor Details
#initialize(name, description = nil, info = nil) ⇒ Condition
Returns a new instance of Condition.
33 34 35 36 37 38 |
# File 'lib/core/condition.rb', line 33 def initialize(name, description = nil, info = nil) @name = name @description = description @info = info super(to_s) end |
Instance Attribute Details
#description (readonly)
31 32 33 |
# File 'lib/core/condition.rb', line 31 def description @description end |
#info (readonly)
31 32 33 |
# File 'lib/core/condition.rb', line 31 def info @info end |
#name (readonly)
31 32 33 |
# File 'lib/core/condition.rb', line 31 def name @name end |
Class Method Details
.convert(obj, default_name = "error") ⇒ Condition
Convert an object to a condition.
-
Condition: return obj
-
Exception: return Condition(obj.class.name, obj.to_s)
-
String-like: return String.try_convert(obj)
-
nil: return nil
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/core/condition.rb', line 60 def self.convert(obj, default_name="error") case obj when nil then nil when Condition then obj when Exception then Condition.new(obj.class.name, obj.to_s) when SWIG::TYPE_p_pn_condition_t if Cproton.pn_condition_is_set(obj) Condition.new(Cproton.pn_condition_get_name(obj), Cproton.pn_condition_get_description(obj), Codec::Data.to_object(Cproton.pn_condition_info(obj))) end else raise ::ArgumentError, "can't convert #{obj.class.name} to #{self.class.name}" unless obj.respond_to? :to_str Condition.new(default_name, obj.to_str) end end |
Instance Method Details
#==(other)
44 45 46 47 48 49 |
# File 'lib/core/condition.rb', line 44 def ==(other) ((other.is_a? Condition) && (other.name == self.name) && (other.description == self.description) && (other.info == self.info)) end |
#inspect
42 |
# File 'lib/core/condition.rb', line 42 def inspect() "#{self.class.name}(#{@name.inspect}, #{@description.inspect}, #{@info.inspect})"; end |
#to_s
40 |
# File 'lib/core/condition.rb', line 40 def to_s() "#{@name}: #{@description}"; end |