class Grape::Entity::Condition::Base
Public Class Methods
new(inverse, ...)
click to toggle source
Calls superclass method
# File lib/grape_entity/condition/base.rb, line 7 def self.new(inverse, ...) super(inverse).tap { |e| e.setup(...) } end
new(inverse = false)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 11 def initialize(inverse = false) @inverse = inverse end
Public Instance Methods
==(other)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 15 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 27 def if_value(_entity, _options) raise NotImplementedError end
inversed?()
click to toggle source
# File lib/grape_entity/condition/base.rb, line 19 def inversed? @inverse end
met?(entity, options)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 23 def met?(entity, options) @inverse ? unless_value(entity, options) : if_value(entity, options) end
unless_value(entity, options)
click to toggle source
# File lib/grape_entity/condition/base.rb, line 31 def unless_value(entity, options) !if_value(entity, options) end