Sha256: caa57d58fb97c202ed081338be355f30415a79135b04b9280043b0273f053dfc

Contents?: true

Size: 485 Bytes

Versions: 4

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

require 'plumb/composable'

module Plumb
  class Not
    include Composable

    attr_reader :children, :errors

    def initialize(step, errors: nil)
      @step = step
      @errors = errors
      @children = [step].freeze
      freeze
    end

    private def _inspect
      %(Not(#{@step.inspect}))
    end

    def call(result)
      result = @step.call(result)
      result.valid? ? result.invalid(errors: @errors) : result.valid
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plumb-0.0.7 lib/plumb/not.rb
plumb-0.0.6 lib/plumb/not.rb
plumb-0.0.5 lib/plumb/not.rb
plumb-0.0.4 lib/plumb/not.rb