Class: WSDL::Config
- Inherits:
-
Object
- Object
- WSDL::Config
- Defined in:
- lib/wsdl/config.rb
Overview
Instance Attribute Summary collapse
-
#limits ⇒ Limits
readonly
Resource limits for request validation.
-
#strictness ⇒ Strictness
readonly
Strictness settings for request validation.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
True if equal.
-
#hash ⇒ Integer
The hash code.
-
#initialize(strictness: nil, limits: nil) ⇒ Config
constructor
A new instance of Config.
-
#inspect ⇒ String
Human-readable representation.
-
#to_h ⇒ Hash{Symbol => Object}
The config as a hash.
-
#with(**options) ⇒ Config
Creates a new Config with some values changed.
Constructor Details
#initialize(strictness: nil, limits: nil) ⇒ Config
Returns a new instance of Config.
26 27 28 29 30 31 |
# File 'lib/wsdl/config.rb', line 26 def initialize(strictness: nil, limits: nil) @strictness = Strictness.resolve(strictness) || Strictness.new @limits = Limits.resolve(limits) || Limits.new freeze end |
Instance Attribute Details
#limits ⇒ Limits (readonly)
Returns resource limits for request validation.
37 38 39 |
# File 'lib/wsdl/config.rb', line 37 def limits @limits end |
#strictness ⇒ Strictness (readonly)
Returns strictness settings for request validation.
34 35 36 |
# File 'lib/wsdl/config.rb', line 34 def strictness @strictness end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Returns true if equal.
66 67 68 69 70 |
# File 'lib/wsdl/config.rb', line 66 def ==(other) return false unless other.is_a?(Config) to_h == other.to_h end |
#hash ⇒ Integer
Returns the hash code.
75 76 77 |
# File 'lib/wsdl/config.rb', line 75 def hash to_h.hash end |
#inspect ⇒ String
Returns human-readable representation.
80 81 82 83 |
# File 'lib/wsdl/config.rb', line 80 def inspect parts = to_h.map { |key, value| "#{key}=#{value.inspect}" }.join(' ') "#<#{self.class.name} #{parts}>" end |
#to_h ⇒ Hash{Symbol => Object}
Returns the config as a hash.
57 58 59 60 61 62 |
# File 'lib/wsdl/config.rb', line 57 def to_h { strictness: @strictness, limits: @limits } end |
#with(**options) ⇒ Config
Creates a new Config with some values changed.
49 50 51 52 53 54 |
# File 'lib/wsdl/config.rb', line 49 def with(**) self.class.new( strictness: .fetch(:strictness, @strictness), limits: .fetch(:limits, @limits) ) end |