Sha256: 9e606619c10084c00a7fe9a4ddf11d9d8f628915accb2f30b14b1aa87206a912

Contents?: true

Size: 501 Bytes

Versions: 3

Compression:

Stored size: 501 Bytes

Contents

module Shogun
  class Presenters
    include Enumerable

    def initialize(resources:, cast:, includes: [], meta: {}, links: {}, linked: {})
      @sources = resources.map do |resource|
        cast.new(resource: resource, includes: includes)
      end
      @meta = meta
      @links = links
      @linked = linked
    end

    def each(&block)
      @sources.each(&block)
    end

    def meta
      @meta
    end

    def linked
      @linked
    end

    def links
      @links
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shogun-3.4.0 lib/shogun/presenters.rb
shogun-3.2.0 lib/shogun/presenters.rb
shogun-3.1.0 lib/shogun/presenters.rb