Sha256: c08027d814d2e3432322af36c015b51d159f254025bc8f5f6acd6a614bd1a1ee

Contents?: true

Size: 711 Bytes

Versions: 5

Compression:

Stored size: 711 Bytes

Contents

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
      def self.new_if(arg)
        case arg
        when Hash then HashCondition.new false, arg
        when Proc then BlockCondition.new false, &arg
        when Symbol then SymbolCondition.new false, arg
        end
      end

      def self.new_unless(arg)
        case arg
        when Hash then HashCondition.new true, arg
        when Proc then BlockCondition.new true, &arg
        when Symbol then SymbolCondition.new true, arg
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-entity-0.6.1 lib/grape_entity/condition.rb
grape-entity-0.6.0 lib/grape_entity/condition.rb
grape-entity-0.5.2 lib/grape_entity/condition.rb
grape-entity-0.5.1 lib/grape_entity/condition.rb
grape-entity-0.5.0 lib/grape_entity/condition.rb