Class: Lich::DragonRealms::DRCTH::CommuneSenseResult
- Inherits:
-
Object
- Object
- Lich::DragonRealms::DRCTH::CommuneSenseResult
- Defined in:
- documented/dragonrealms/commons/common-theurgy.rb
Overview
Data class for commune_sense results. Replaces raw hash return. Supports [] for backward compat with callers using result.
captured is false when the COMMUNE SENSE reply was not captured in
full: no reply arrived (a timeout), or the reply was cut off before its
Roundtime line. commune_ready is then false so the result never reads as
ready; treat it as "unknown". After a timeout the lists are empty; after
a cut-off reply they hold what arrived, which may not be everything.
captured true means a complete reply was read; it does not prove the
reply was sent in answer to this call (the tail of a reply that arrives
after an earlier call timed out can still be read by the next call,
since COMMUNE_SENSE_START also matches lines from the middle of a reply).
Instance Attribute Summary collapse
-
#active_communes ⇒ Object
readonly
Returns the value of attribute active_communes.
-
#captured ⇒ Object
readonly
Returns the value of attribute captured.
-
#commune_ready ⇒ Object
readonly
Returns the value of attribute commune_ready.
-
#recent_communes ⇒ Object
readonly
Returns the value of attribute recent_communes.
Instance Method Summary collapse
-
#[](key) ⇒ Array<String>, Boolean
Hash-style accessor for backward compatibility with older calling code.
-
#captured? ⇒ Boolean
True when the COMMUNE SENSE reply was captured.
-
#commune_ready? ⇒ Boolean
Returns true if the character is ready to open another divine conduit.
-
#initialize(active_communes: [], recent_communes: [], commune_ready: true, captured: true) ⇒ CommuneSenseResult
constructor
Initializes a CommuneSenseResult with commune status data.
Constructor Details
#initialize(active_communes: [], recent_communes: [], commune_ready: true, captured: true) ⇒ CommuneSenseResult
Initializes a CommuneSenseResult with commune status data.
76 77 78 79 80 81 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 76 def initialize(active_communes: [], recent_communes: [], commune_ready: true, captured: true) @active_communes = active_communes.freeze @recent_communes = recent_communes.freeze @commune_ready = commune_ready @captured = captured end |
Instance Attribute Details
#active_communes ⇒ Object (readonly)
Returns the value of attribute active_communes.
68 69 70 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 68 def active_communes @active_communes end |
#captured ⇒ Object (readonly)
Returns the value of attribute captured.
68 69 70 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 68 def captured @captured end |
#commune_ready ⇒ Object (readonly)
Returns the value of attribute commune_ready.
68 69 70 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 68 def commune_ready @commune_ready end |
#recent_communes ⇒ Object (readonly)
Returns the value of attribute recent_communes.
68 69 70 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 68 def recent_communes @recent_communes end |
Instance Method Details
#[](key) ⇒ Array<String>, Boolean
104 105 106 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 104 def [](key) send(key.to_sym) end |
#captured? ⇒ Boolean
Returns true when the COMMUNE SENSE reply was captured.
91 92 93 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 91 def captured? @captured end |
#commune_ready? ⇒ Boolean
Returns true if the character is ready to open another divine conduit.
86 87 88 |
# File 'documented/dragonrealms/commons/common-theurgy.rb', line 86 def commune_ready? @commune_ready end |