Sha256: 3869bc6248330ae2bf9b15994988d0997b7b9561bd5f70abb2c4197a8dbf53f2

Contents?: true

Size: 416 Bytes

Versions: 18

Compression:

Stored size: 416 Bytes

Contents

module Datacaster
  class OrNode < Base
    def initialize(left, right)
      @left = left
      @right = right
    end

    def cast(object, runtime:)
      left_result = @left.with_runtime(runtime).(object)

      return left_result if left_result.valid?

      @right.with_runtime(runtime).(object)
    end

    def inspect
      "#<Datacaster::OrNode L: #{@left.inspect} R: #{@right.inspect}>"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
datacaster-4.1.0 lib/datacaster/or_node.rb
datacaster-4.0.1 lib/datacaster/or_node.rb
datacaster-3.3.1 lib/datacaster/or_node.rb
datacaster-3.3.0 lib/datacaster/or_node.rb
datacaster-3.2.7 lib/datacaster/or_node.rb
datacaster-3.2.6 lib/datacaster/or_node.rb
datacaster-3.2.5 lib/datacaster/or_node.rb
datacaster-3.2.4 lib/datacaster/or_node.rb
datacaster-3.2.3 lib/datacaster/or_node.rb
datacaster-3.2.2 lib/datacaster/or_node.rb
datacaster-3.2.1 lib/datacaster/or_node.rb
datacaster-3.2.0 lib/datacaster/or_node.rb
datacaster-3.1.5 lib/datacaster/or_node.rb
datacaster-3.1.3 lib/datacaster/or_node.rb
datacaster-3.1.2 lib/datacaster/or_node.rb
datacaster-3.1.1 lib/datacaster/or_node.rb
datacaster-3.1.0 lib/datacaster/or_node.rb
datacaster-3.0.0 lib/datacaster/or_node.rb