Class: Sofia::Types::Params
- Inherits:
-
Object
- Object
- Sofia::Types::Params
- Extended by:
- T::Sig
- Defined in:
- lib/sofia/types/params.rb
Instance Method Summary collapse
-
#[](key) ⇒ Object
: (untyped key) -> void.
-
#[]=(key, value) ⇒ Object
: (untyped key, untyped value) -> void.
-
#initialize(params = {}) ⇒ Params
constructor
: (?untyped params) -> void.
-
#to_h ⇒ Object
: -> Hash[String, String].
-
#to_s ⇒ Object
: -> String.
Constructor Details
#initialize(params = {}) ⇒ Params
: (?untyped params) -> void
11 12 13 |
# File 'lib/sofia/types/params.rb', line 11 def initialize(params = {}) # rubocop:disable Style/OptionHash @params = validate_and_normalize(params || {}) #: Hash[String, String] end |
Instance Method Details
#[](key) ⇒ Object
: (untyped key) -> void
16 17 18 |
# File 'lib/sofia/types/params.rb', line 16 def [](key) @params[key.to_s] end |
#[]=(key, value) ⇒ Object
: (untyped key, untyped value) -> void
21 22 23 |
# File 'lib/sofia/types/params.rb', line 21 def []=(key, value) @params[key.to_s] = value.to_s end |
#to_h ⇒ Object
: -> Hash[String, String]
26 27 28 |
# File 'lib/sofia/types/params.rb', line 26 def to_h @params.dup end |
#to_s ⇒ Object
: -> String
31 32 33 |
# File 'lib/sofia/types/params.rb', line 31 def to_s URI.encode_www_form(@params) end |