Sha256: 75e1700422058517e49c130492060c1f861bf597364b5bb5c6920ccb5cd73444
Contents?: true
Size: 528 Bytes
Versions: 5
Compression:
Stored size: 528 Bytes
Contents
module Grape class Entity module Condition class HashCondition < Base attr_reader :cond_hash def setup(cond_hash) @cond_hash = cond_hash end def ==(other) super && @cond_hash == other.cond_hash end def if_value(_entity, options) @cond_hash.all? { |k, v| options[k.to_sym] == v } end def unless_value(_entity, options) @cond_hash.any? { |k, v| options[k.to_sym] != v } end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems