Class: Lich::Common::Inventory::Handler Private
- Inherits:
-
Object
- Object
- Lich::Common::Inventory::Handler
- Defined in:
- documented/common/inventory.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Ox SAX handler for a SINGLE isolated inventoryManager line. Collects
decoded item attribute hashes and any parse errors, and flags a
continuation (paginated) response. Mirrors the +error+-callback pattern
in XMLParser because Ox never raises on malformed input -- it
auto-closes and reports damage only through #error.
Instance Attribute Summary collapse
-
#after ⇒ String?
readonly
private
The envelope
aftercursor (continuation response). -
#continuations ⇒ Array<Hash>
readonly
private
Raw attribute hashes, one per
(each carries a rootandlastmarker for a branch not yet sent). -
#errors ⇒ Array<String>
readonly
private
Collected Ox parse-error messages.
-
#items ⇒ Array<Hash>
readonly
private
Raw attribute hashes, one per .
-
#manager_id ⇒ String?
readonly
private
The envelope
id(request id). -
#room_id ⇒ String?
readonly
private
The envelope
roomattribute. -
#root ⇒ String?
readonly
private
The envelope
root(present on a continuation response; must be absent on an initial response). -
#state ⇒ String?
readonly
private
The envelope
state("stale" == interrupted).
Instance Method Summary collapse
- #attr(name, value) ⇒ void private
-
#attrs_done ⇒ void
private
Flush accumulated attributes for the current element.
- #cdata(_value) ⇒ void private
-
#continuation? ⇒ Boolean
private
Whether this response is part of a paginated exchange: it either carries
<continuation>children (more branches to fetch) or is itself a continuation response (has a +root+/+after+ envelope). - #end_element(_name) ⇒ void private
- #error(message, line, column) ⇒ void private
-
#initialize ⇒ Handler
constructor
private
A new instance of Handler.
- #start_element(name) ⇒ void private
- #text(_value) ⇒ void private
Constructor Details
#initialize ⇒ Handler
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Handler.
682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'documented/common/inventory.rb', line 682 def initialize @items = [] @errors = [] @room_id = nil @manager_id = nil @root = nil @after = nil @state = nil @continuations = [] @element = nil @attributes = nil end |
Instance Attribute Details
#after ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the envelope after cursor (continuation response).
673 674 675 |
# File 'documented/common/inventory.rb', line 673 def after @after end |
#continuations ⇒ Array<Hash> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns raw attribute hashes, one per root and last marker for a branch not yet sent).
680 681 682 |
# File 'documented/common/inventory.rb', line 680 def continuations @continuations end |
#errors ⇒ Array<String> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns collected Ox parse-error messages.
660 661 662 |
# File 'documented/common/inventory.rb', line 660 def errors @errors end |
#items ⇒ Array<Hash> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns raw attribute hashes, one per .
657 658 659 |
# File 'documented/common/inventory.rb', line 657 def items @items end |
#manager_id ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the envelope id (request id).
666 667 668 |
# File 'documented/common/inventory.rb', line 666 def manager_id @manager_id end |
#room_id ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the envelope room attribute.
663 664 665 |
# File 'documented/common/inventory.rb', line 663 def room_id @room_id end |
#root ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the envelope root (present on a continuation
response; must be absent on an initial response).
670 671 672 |
# File 'documented/common/inventory.rb', line 670 def root @root end |
#state ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the envelope state ("stale" == interrupted).
676 677 678 |
# File 'documented/common/inventory.rb', line 676 def state @state end |
Instance Method Details
#attr(name, value) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
705 706 707 |
# File 'documented/common/inventory.rb', line 705 def attr(name, value) @attributes[name] = value if @attributes end |
#attrs_done ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Flush accumulated attributes for the current element.
712 713 714 715 716 717 718 719 720 721 722 723 724 725 |
# File 'documented/common/inventory.rb', line 712 def attrs_done case @element when 'inventoryManager' @manager_id = @attributes['id'] @room_id = @attributes['room'] @root = @attributes['root'] @after = @attributes['after'] @state = @attributes['state'] when 'i' @items << @attributes when 'continuation' @continuations << @attributes end end |
#cdata(_value) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
737 |
# File 'documented/common/inventory.rb', line 737 def cdata(_value); end |
#continuation? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether this response is part of a paginated exchange:
it either carries <continuation> children (more branches to fetch) or
is itself a continuation response (has a +root+/+after+ envelope).
750 751 752 |
# File 'documented/common/inventory.rb', line 750 def continuation? !@continuations.empty? || !@root.nil? || !@after.nil? end |
#end_element(_name) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
729 |
# File 'documented/common/inventory.rb', line 729 def end_element(_name); end |
#error(message, line, column) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
743 744 745 |
# File 'documented/common/inventory.rb', line 743 def error(, line, column) @errors << "#{} (line #{line}, column #{column})" end |
#start_element(name) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
697 698 699 700 |
# File 'documented/common/inventory.rb', line 697 def start_element(name) @element = name @attributes = {} end |
#text(_value) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
733 |
# File 'documented/common/inventory.rb', line 733 def text(_value); end |