Sha256: 720cedf5b432176281e89c331c2133d1dd729fecfd824a8f84a193bf03d4db3c

Contents?: true

Size: 412 Bytes

Versions: 1

Compression:

Stored size: 412 Bytes

Contents

module Beambridge
  class Matcher
    attr_accessor :condition, :block
    attr_accessor :receiver

    def initialize(parent, condition, block)
      self.receiver = parent
      @block = block
      @condition = Condition.for(condition)
    end

    def run(arg)
      args = @condition.binding_for(arg)
      block.call(*args)
    end

    def matches?(arg)
      @condition.satisfies?(arg)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beambridge-0.9.0 lib/beambridge/matcher.rb