Module: OpenapiFirst::Utils
- Defined in:
- lib/openapi_first/utils.rb
Class Method Summary collapse
- .classify(string) ⇒ Object
- .deep_merge!(dest, source) ⇒ Object
-
.deep_stringify(params) ⇒ Object
rubocop:disable Metrics/MethodLength.
- .underscore(string) ⇒ Object
Class Method Details
.classify(string) ⇒ Object
16 17 18 |
# File 'lib/openapi_first/utils.rb', line 16 def self.classify(string) Hanami::Utils::String.classify(string) end |
.deep_merge!(dest, source) ⇒ Object
8 9 10 |
# File 'lib/openapi_first/utils.rb', line 8 def self.deep_merge!(dest, source) DeepMerge.deep_merge!(source, dest) end |
.deep_stringify(params) ⇒ Object
rubocop:disable Metrics/MethodLength
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/openapi_first/utils.rb', line 20 def self.deep_stringify(params) # rubocop:disable Metrics/MethodLength params.each_with_object({}) do |(key, value), output| output[key.to_s] = case value when ::Hash deep_stringify(value) when Array value.map do |item| item.is_a?(::Hash) ? deep_stringify(item) : item end else value end end end |
.underscore(string) ⇒ Object
12 13 14 |
# File 'lib/openapi_first/utils.rb', line 12 def self.underscore(string) Hanami::Utils::String.underscore(string) end |