Sha256: ffec14e4c28ed9f96a8fccde92b1a64acfe07d1537b7e66851421f7113081f22

Contents?: true

Size: 537 Bytes

Versions: 25

Compression:

Stored size: 537 Bytes

Contents

require 'unstrict_proc'
module JSONAPIonify
  class Continuation
    using UnstrictProc

    def initialize(**options)
      @options = options
    end

    def check(*arguments)
      yield if check_if(*arguments) && check_unless(*arguments)
    end

    private

    def check_if(*arguments)
      return true unless @options[:if]
      @options[:if].unstrict.call(*arguments)
    end

    def check_unless(*arguments)
      return true unless @options[:unless]
      not @options[:unless].unstrict.call(*arguments)
    end

  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
jsonapionify-0.12.10 lib/jsonapionify/continuation.rb
jsonapionify-0.12.9 lib/jsonapionify/continuation.rb
jsonapionify-0.12.8 lib/jsonapionify/continuation.rb
jsonapionify-0.12.7 lib/jsonapionify/continuation.rb
jsonapionify-0.12.5 lib/jsonapionify/continuation.rb
jsonapionify-0.12.4 lib/jsonapionify/continuation.rb
jsonapionify-0.12.3 lib/jsonapionify/continuation.rb
jsonapionify-0.12.2 lib/jsonapionify/continuation.rb
jsonapionify-0.12.1 lib/jsonapionify/continuation.rb
jsonapionify-0.12.0 lib/jsonapionify/continuation.rb
jsonapionify-0.11.11 lib/jsonapionify/continuation.rb
jsonapionify-0.11.10 lib/jsonapionify/continuation.rb
jsonapionify-0.11.9 lib/jsonapionify/continuation.rb
jsonapionify-0.11.8 lib/jsonapionify/continuation.rb
jsonapionify-0.11.7 lib/jsonapionify/continuation.rb
jsonapionify-0.11.6 lib/jsonapionify/continuation.rb
jsonapionify-0.11.5 lib/jsonapionify/continuation.rb
jsonapionify-0.11.0 lib/jsonapionify/continuation.rb
jsonapionify-0.10.2 lib/jsonapionify/continuation.rb
jsonapionify-0.10.1 lib/jsonapionify/continuation.rb