Sha256: 7b4f94880a83f14887c302f056fd295ff909d4587a84bc3b93e17855be332295

Contents?: true

Size: 639 Bytes

Versions: 29

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literal: true

module Dato
  module Local
    class JsonApiMeta
      attr_reader :payload

      def initialize(payload)
        @payload = payload || {}
      end

      def [](key)
        @payload[key]
      end

      def respond_to_missing?(method, include_private = false)
        if @payload.key?(method)
          true
        else
          super
        end
      end

      private

      def method_missing(method, *arguments, &block)
        return super unless arguments.empty?

        if @payload.key?(method)
          @payload[method]
        else
          super
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
dato-0.7.0 lib/dato/local/json_api_meta.rb
dato-0.6.18 lib/dato/local/json_api_meta.rb
dato-0.6.17 lib/dato/local/json_api_meta.rb
dato-0.6.16 lib/dato/local/json_api_meta.rb
dato-0.6.15 lib/dato/local/json_api_meta.rb
dato-0.6.14 lib/dato/local/json_api_meta.rb
dato-0.6.12 lib/dato/local/json_api_meta.rb
dato-0.6.11 lib/dato/local/json_api_meta.rb
dato-0.6.10 lib/dato/local/json_api_meta.rb