Class: WSDL::Parser::OperationMap Private
- Inherits:
-
Object
- Object
- WSDL::Parser::OperationMap
- Defined in:
- lib/wsdl/parser/operation_map.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.
Stores operations by name, supporting WSDL 1.1 operation overloading.
Both PortType and Binding use this to store their operations.
Consumers get clean single-operation lookups — overload handling
is encapsulated. Operations must respond to #input_name for
disambiguation when overloaded.
Instance Method Summary collapse
-
#add(name, operation) ⇒ void
private
Adds an operation.
-
#fetch(name, input_name: nil) { ... } ⇒ Object
private
Fetches a single operation by name.
-
#include?(name) ⇒ Boolean
private
Whether a name exists in the map.
-
#initialize ⇒ OperationMap
constructor
private
A new instance of OperationMap.
-
#keys ⇒ Array<String>
private
Returns unique operation names.
-
#overload_count(name) ⇒ Integer
private
Number of definitions for a name.
-
#overloaded_name?(name) ⇒ Boolean
private
Whether a specific name has multiple definitions.
-
#to_a ⇒ Array<Hash>
private
Returns an array of operation summary hashes.
Constructor Details
#initialize ⇒ OperationMap
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 OperationMap.
20 21 22 |
# File 'lib/wsdl/parser/operation_map.rb', line 20 def initialize @entries = {} end |
Instance Method Details
#add(name, operation) ⇒ 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.
Adds an operation. Multiple operations with the same name are allowed per WSDL 1.1 §2.4.5 (operation overloading).
30 31 32 |
# File 'lib/wsdl/parser/operation_map.rb', line 30 def add(name, operation) (@entries[name] ||= []) << operation end |
#fetch(name, input_name: nil) { ... } ⇒ Object
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.
Fetches a single operation by name.
For non-overloaded names, returns the operation directly. For
overloaded names, uses input_name: to disambiguate. Raises
ArgumentError if overloaded and no input_name is provided.
61 62 63 64 65 66 67 |
# File 'lib/wsdl/parser/operation_map.rb', line 61 def fetch(name, input_name: nil, ¬_found) ops = @entries.fetch(name, ¬_found) return ops unless ops.is_a?(Array) return ops.first if ops.one? resolve_overload(name, input_name, ops) end |
#include?(name) ⇒ 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.
Whether a name exists in the map.
45 46 47 |
# File 'lib/wsdl/parser/operation_map.rb', line 45 def include?(name) @entries.key?(name) end |
#keys ⇒ Array<String>
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 unique operation names.
37 38 39 |
# File 'lib/wsdl/parser/operation_map.rb', line 37 def keys @entries.keys end |
#overload_count(name) ⇒ Integer
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.
Number of definitions for a name.
82 83 84 |
# File 'lib/wsdl/parser/operation_map.rb', line 82 def overload_count(name) @entries[name]&.size || 0 end |
#overloaded_name?(name) ⇒ 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.
Whether a specific name has multiple definitions.
73 74 75 76 |
# File 'lib/wsdl/parser/operation_map.rb', line 73 def overloaded_name?(name) ops = @entries[name] !ops.nil? && ops.size > 1 end |
#to_a ⇒ Array<Hash>
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 an array of operation summary hashes.
Non-overloaded operations produce { name: "..." }.
Overloaded operations include input_name for disambiguation.
92 93 94 95 96 97 98 99 100 |
# File 'lib/wsdl/parser/operation_map.rb', line 92 def to_a @entries.flat_map do |name, ops| if ops.one? [{ name: }] else ops.map { |op| { name:, input_name: op.input_name } } end end end |