Sha256: 9912a63e48657dfbde4114397affbf2097afc5e98f6c056a944708c88670a114
Contents?: true
Size: 735 Bytes
Versions: 1
Compression:
Stored size: 735 Bytes
Contents
# frozen_string_literal: true require "date" require "erb" require "pathname" require "yaml" module Mihari module Services # # Alert builder # class AlertBuilder < Service # @return [String] attr_reader :path # # Initialize # # @param [String] path # def initialize(path) super() @path = path end # # @return [Hash] # def data raise ArgumentError, "#{path} does not exist" unless Pathname(path).exist? YAML.safe_load( ERB.new(File.read(path)).result, permitted_classes: [Date, Symbol] ) end def call AlertProxy.new(**data) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.7.0 | lib/mihari/services/alert_builder.rb |