Sha256: f2355c8ddbf1dfd3822fcb27e8c24c1761d978f07e719e21fee1066c868acf03

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
jsonapionify-0.0.1.pre lib/jsonapionify/continuation.rb