Module: Matchd::Rule::Factory
- Included in:
- Matchd
- Defined in:
- lib/matchd/rule.rb
Instance Method Summary collapse
-
#Rule(data) ⇒ Object
rubocop:disable Naming/MethodName.
Instance Method Details
#Rule(data) ⇒ Object
rubocop:disable Naming/MethodName
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/matchd/rule.rb', line 99 def Rule(data) # rubocop:disable Naming/MethodName return Rule::Invalid.new(data) unless data.is_a?(Hash) if data["respond"] Rule::Respond.new(data) elsif data["append_question"] Rule::Append.new(data) elsif data["passthrough"] Rule::Passthrough.new(data) elsif data["fail"] Rule::Fail.new(data) else Rule::Invalid.new(data) end end |