Sha256: bf0c76b85c9f110de51307ce0f31d98c36aef0cbe24e340f14a4893d3fb9940f

Contents?: true

Size: 609 Bytes

Versions: 10

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

require "hachi"

module Mihari
  class Artifact
    attr_reader :data

    #
    # @param [String] data
    # @param [String, nil] message
    #
    def initialize(data, message: nil)
      @data = data
      @message = message
    end

    # @return [String, nil]
    def data_type
      TypeChecker.type data
    end

    # @return [String]
    def message
      @mesasge || data
    end

    # @return [true, false]
    def valid?
      !data_type.nil?
    end

    # @return [Hash]
    def to_h
      { data: data, data_type: data_type, message: message }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mihari-0.4.2 lib/mihari/artifact.rb
mihari-0.4.0 lib/mihari/artifact.rb
mihari-0.3.0 lib/mihari/artifact.rb
mihari-0.2.5 lib/mihari/artifact.rb
mihari-0.2.4 lib/mihari/artifact.rb
mihari-0.2.3 lib/mihari/artifact.rb
mihari-0.2.2 lib/mihari/artifact.rb
mihari-0.2.1 lib/mihari/artifact.rb
mihari-0.2.0 lib/mihari/artifact.rb
mihari-0.1.0 lib/mihari/artifact.rb