Class: Matchd::Rule::Append
- Inherits:
-
Matchd::Rule
- Object
- Matchd::Rule
- Matchd::Rule::Append
- Defined in:
- lib/matchd/rule/append.rb
Constant Summary
Constants inherited from Matchd::Rule
NotImplementedError, REGEXP_MATCHER, REGEXP_OPTIONS
Instance Attribute Summary collapse
-
#append_questions ⇒ Object
readonly
Returns the value of attribute append_questions.
-
#transaction_options ⇒ Object
readonly
Returns the value of attribute transaction_options.
Attributes inherited from Matchd::Rule
Instance Method Summary collapse
-
#initialize(options) ⇒ Append
constructor
A new instance of Append.
- #visit!(_server, _name, _resource_class, transaction) ⇒ Object
Methods inherited from Matchd::Rule
#call, #match_name, #match_resource_classes, #matches?, parse_match, parse_resource_class
Constructor Details
#initialize(options) ⇒ Append
Returns a new instance of Append.
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/matchd/rule/append.rb', line 2 def initialize() super opts = .fetch("append_question") if opts.is_a?(Hash) @append_questions = Array(opts.fetch("resource_class")) @transaction_options = Matchd::Helpers.(%w(ttl name section), opts) else @append_questions = Array(opts) @transaction_options = {} end end |
Instance Attribute Details
#append_questions ⇒ Object (readonly)
Returns the value of attribute append_questions.
15 16 17 |
# File 'lib/matchd/rule/append.rb', line 15 def append_questions @append_questions end |
#transaction_options ⇒ Object (readonly)
Returns the value of attribute transaction_options.
15 16 17 |
# File 'lib/matchd/rule/append.rb', line 15 def @transaction_options end |
Instance Method Details
#visit!(_server, _name, _resource_class, transaction) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/matchd/rule/append.rb', line 17 def visit!(_server, _name, _resource_class, transaction) transaction.append_question! Matchd::Rule.parse_resource_class(append_questions).each do |append_resource_class| transaction.append!(transaction.name, append_resource_class, ) end end |