Class: Grape::Entity::Condition::BlockCondition

Inherits:
Base
  • Object
show all
Defined in:
lib/grape_entity/condition/block_condition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inversed?, #met?, new, #unless_value

Constructor Details

This class inherits a constructor from Grape::Entity::Condition::Base

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block


7
8
9
# File 'lib/grape_entity/condition/block_condition.rb', line 7

def block
  @block
end

Instance Method Details

#==(other) ⇒ Object


13
14
15
# File 'lib/grape_entity/condition/block_condition.rb', line 13

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

#if_value(entity, options) ⇒ Object


17
18
19
# File 'lib/grape_entity/condition/block_condition.rb', line 17

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

#setup(&block) ⇒ Object


9
10
11
# File 'lib/grape_entity/condition/block_condition.rb', line 9

def setup(&block)
  @block = block
end