Sha256: 260d951018225ea0e07a616898547862df84c3ce7ce3ba20800c2f53b1431bcb

Contents?: true

Size: 622 Bytes

Versions: 11

Compression:

Stored size: 622 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module EML
  module UK
    class Response < ::EML::Response
      class << self
        extend T::Sig

        protected

        sig { params(field_name: Symbol).void }
        def field(field_name)
          string_name = field_name.to_s
          return date_field(field_name) if string_name.include?("date")

          super
        end

        sig { params(field_name: Symbol).void }
        def date_field(field_name)
          define_method(field_name) do
            ::EML::UK::ParseDate.(body[field_name.to_s])
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eml-2.1.8 lib/eml/uk/response.rb
eml-2.1.7 lib/eml/uk/response.rb
eml-2.1.6 lib/eml/uk/response.rb
eml-2.1.5 lib/eml/uk/response.rb
eml-2.1.4 lib/eml/uk/response.rb
eml-2.1.3 lib/eml/uk/response.rb
eml-2.1.2 lib/eml/uk/response.rb
eml-2.1.1 lib/eml/uk/response.rb
eml-2.1.0 lib/eml/uk/response.rb
eml-2.0.0 lib/eml/uk/response.rb
eml-1.0.0 lib/eml/uk/response.rb