Class: Mihari::Services::RuleBuilder
- Inherits:
-
Mihari::Service
- Object
- Mihari::Service
- Mihari::Services::RuleBuilder
- Defined in:
- lib/mihari/services/builders.rb
Overview
Rule builder
Instance Method Summary collapse
Methods inherited from Mihari::Service
Instance Method Details
#call(path_or_id) ⇒ Mihari::Rule
14 15 16 17 18 19 20 21 |
# File 'lib/mihari/services/builders.rb', line 14 def call(path_or_id) res = Try { Rule.from_model Mihari::Models::Rule.find(path_or_id) } return res.value! if res.value? raise ArgumentError, "#{path_or_id} not found" unless Pathname(path_or_id).exist? Rule.from_yaml ERB.new(File.read(path_or_id)).result end |