Sha256: f0222e924d7f948f376777e49a546a89175b794c95f1e1d952f804ddb8003204

Contents?: true

Size: 445 Bytes

Versions: 1

Compression:

Stored size: 445 Bytes

Contents

class Matchd::Rule::Respond < Matchd::Rule
  def initialize(options)
    super
    @responses = options.fetch("respond")
  end

  attr_reader :responses

  def visit!(_server, _name, _resource_class, transaction)
    # Using the original Rule's resource_classes definition as a fallback, if
    # the response doesn't configure one.
    Matchd.Response(responses, @resource_classes).each do |resp|
      resp.call(transaction)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
matchd-0.1.0 lib/matchd/rule/respond.rb