class Grape::Entity::Condition::Base
Public Class Methods
new(inverse = false)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 10 def initialize(inverse = false) @inverse = inverse end
new(inverse, *args, &block)
click to toggle source
Calls superclass method
# File lib/grape_entity/condition/base.rb, line 6 def self.new(inverse, *args, &block) super(inverse).tap { |e| e.setup(*args, &block) } end
Public Instance Methods
==(other)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 14 def ==(other) (self.class == other.class) && (inversed? == other.inversed?) end
if_value(_entity, _options)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 26 def if_value(_entity, _options) raise NotImplementedError end
inversed?()
click to toggle source
# File lib/grape_entity/condition/base.rb, line 18 def inversed? @inverse end
met?(entity, options)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 22 def met?(entity, options) !@inverse ? if_value(entity, options) : unless_value(entity, options) end
unless_value(entity, options)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 30 def unless_value(entity, options) !if_value(entity, options) end