Sha256: 67c0d852ce3d58d4623721eb128dd47c64bb0b8f6ba9df620a006e93cb7743f5

Contents?: true

Size: 517 Bytes

Versions: 11

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true

module Grape
  class Entity
    module Exposure
      class BlockExposure < Base
        attr_reader :block

        def value(entity, options)
          entity.exec_with_object(options, &@block)
        end

        def dup
          super(&@block)
        end

        def ==(other)
          super && @block == other.block
        end

        def valid?(_entity)
          true
        end

        def setup(&block)
          @block = block
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
grape-entity-1.0.1 lib/grape_entity/exposure/block_exposure.rb
grape-entity-1.0.0 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.10.2 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.10.1 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.10.0 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.9.0 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.8.2 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.8.1 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.8.0 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.7.1 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.7.0 lib/grape_entity/exposure/block_exposure.rb