Sha256: e08f37dd14ea7384b2643baa4a6ee93305695b6e7f7239489982ba8131b7ab7f
Contents?: true
Size: 758 Bytes
Versions: 11
Compression:
Stored size: 758 Bytes
Contents
# frozen_string_literal: true require 'grape_entity/condition/base' require 'grape_entity/condition/block_condition' require 'grape_entity/condition/hash_condition' require 'grape_entity/condition/symbol_condition' module Grape class Entity module Condition class << self def new_if(arg) condition(false, arg) end def new_unless(arg) condition(true, arg) end private def condition(inverse, arg) condition_klass = case arg when Hash then HashCondition when Proc then BlockCondition when Symbol then SymbolCondition end condition_klass.new(inverse, arg) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems