Sha256: d36e5510313fde84c78f6fafa14f683b8af7d69f16bac464e007cb38f1a0d4d9

Contents?: true

Size: 796 Bytes

Versions: 12

Compression:

Stored size: 796 Bytes

Contents

# frozen_string_literal: true

require 'easy/jsonapi/name_value_pair_collection'
require 'easy/jsonapi/document/meta/meta_member' # extension

module JSONAPI
  class Document
    
    # The meta of a resource
    class Meta < JSONAPI::NameValuePairCollection

      # @param meta_arr [Array<JSONAPI::Document::Meta::MetaMember] The 
      #   array of meta members to initialize the collection with
      def initialize(meta_arr = [])
        meta_arr = [meta_arr] unless meta_arr.is_a? Array
        super(meta_arr, item_type: JSONAPI::Document::Meta::MetaMember)
      end

      # Add a jsonapi member to the collection
      # @param meta_member [JSONAPI::Document::Meta::MetaMember] The member to add
      def add(meta_member)
        super(meta_member, &:name)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
easy-jsonapi-1.0.11 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.10 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.9 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.8 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.7 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.6 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.5 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.4 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.3 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.2 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.1 lib/easy/jsonapi/document/meta.rb
easy-jsonapi-1.0.0 lib/easy/jsonapi/document/meta.rb