Sha256: 298ff25da7f7a0cbac66719d0c939c15b530ed0f87197e5f5d483594ff2d5afc

Contents?: true

Size: 411 Bytes

Versions: 11

Compression:

Stored size: 411 Bytes

Contents

# frozen_string_literal: true

module Grape
  class Entity
    module Condition
      class BlockCondition < Base
        attr_reader :block

        def setup(block)
          @block = block
        end

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

        def if_value(entity, options)
          entity.exec_with_object(options, &@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/condition/block_condition.rb
grape-entity-1.0.0 lib/grape_entity/condition/block_condition.rb
grape-entity-0.10.2 lib/grape_entity/condition/block_condition.rb
grape-entity-0.10.1 lib/grape_entity/condition/block_condition.rb
grape-entity-0.10.0 lib/grape_entity/condition/block_condition.rb
grape-entity-0.9.0 lib/grape_entity/condition/block_condition.rb
grape-entity-0.8.2 lib/grape_entity/condition/block_condition.rb
grape-entity-0.8.1 lib/grape_entity/condition/block_condition.rb
grape-entity-0.8.0 lib/grape_entity/condition/block_condition.rb
grape-entity-0.7.1 lib/grape_entity/condition/block_condition.rb
grape-entity-0.7.0 lib/grape_entity/condition/block_condition.rb