Sha256: 26c5e52c528b6129d15488283d7ecb162b8cd062f678b4ec4200b5e3264f654a

Contents?: true

Size: 486 Bytes

Versions: 5

Compression:

Stored size: 486 Bytes

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
grape-entity-0.6.1 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.6.0 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.5.2 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.5.1 lib/grape_entity/exposure/block_exposure.rb
grape-entity-0.5.0 lib/grape_entity/exposure/block_exposure.rb