Sha256: f1a2282bbc51416fb0ba7307c1ddc11b83ba09a85d299d2bfa6c343d0b1b282f
Contents?: true
Size: 968 Bytes
Versions: 28
Compression:
Stored size: 968 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' require 'eac_envs/http/request/body_field' module EacEnvs module Http class Request class BodyFields common_constructor :source_body # @return [Hash, nil] def to_h fields.if_present do |v| v.each_with_object({}) { |e, a| a[e.hash_key] = e.hash_value } end end # @return [Array<EacEnvs::Http::Request::BodyField>, nil] def fields source_body.if_present do |v| next nil unless v.is_a?(::Enumerable) if v.is_a?(::Hash) ::EacEnvs::Http::Request::BodyField.list_from_hash(v) else ::EacEnvs::Http::Request::BodyField.list_from_enumerable(v) end end end # @return [Boolean] def with_file? fields.if_present(false) { |v| v.any?(&:with_file?) } end end end end end
Version data entries
28 entries across 28 versions & 2 rubygems