Sha256: 8f23940e5b7582b32814646e48b85ddd7aa9dcdc15f221253c595e70f7ec1126

Contents?: true

Size: 412 Bytes

Versions: 6

Compression:

Stored size: 412 Bytes

Contents

module GraphQL
  module ResultCache
    class Condition
      def initialize config, obj:, args:, ctx:
        @if = config[:if]
        @obj = obj
        @args = args
        @ctx = ctx
      end

      def true?
        case @if
          when Symbol
            @obj.send(@if)
          when Proc
            @if.call(@obj, @args, @ctx)
          else
            true
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graphql-result_cache-0.1.6 lib/graphql/result_cache/condition.rb
graphql-result_cache-0.1.5 lib/graphql/result_cache/condition.rb
graphql-result_cache-0.1.4 lib/graphql/result_cache/condition.rb
graphql-result_cache-0.1.3 lib/graphql/result_cache/condition.rb
graphql-result_cache-0.1.2 lib/graphql/result_cache/condition.rb
graphql-result_cache-0.1.1 lib/graphql/result_cache/condition.rb