Class: Mihari::Emitters::PayloadTemplate
- Inherits:
-
ERB
- Object
- ERB
- Mihari::Emitters::PayloadTemplate
- Defined in:
- lib/mihari/emitters/http.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title:, description:, artifacts:, source:, tags:, options: {}) ⇒ PayloadTemplate
constructor
A new instance of PayloadTemplate.
- #result ⇒ Object
Constructor Details
#initialize(title:, description:, artifacts:, source:, tags:, options: {}) ⇒ PayloadTemplate
Returns a new instance of PayloadTemplate.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mihari/emitters/http.rb', line 30 def initialize(title:, description:, artifacts:, source:, tags:, options: {}) @title = title @description = description @artifacts = artifacts @source = source = @template = .fetch(:template, self.class.template) super(@template) end |
Class Method Details
.template ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mihari/emitters/http.rb', line 8 def self.template %{ { "title": "<%= @title %>", "description": "<%= @description %>", "source": "<%= @source %>", "artifacts": [ <% @artifacts.each_with_index do |artifact, idx| %> "<%= artifact.data %>" <%= ',' if idx < (@artifacts.length - 1) %> <% end %> ], "tags": [ <% @tags.each_with_index do |tag, idx| %> "<%= tag %>" <%= ',' if idx < (@tags.length - 1) %> <% end %> ] } } end |
Instance Method Details
#result ⇒ Object
41 42 43 |
# File 'lib/mihari/emitters/http.rb', line 41 def result super(binding) end |