Class: Necropsy::AnalyzerProfile
- Inherits:
-
Data
- Object
- Data
- Necropsy::AnalyzerProfile
- Defined in:
- lib/necropsy/models.rb
Instance Attribute Summary collapse
-
#assumptions ⇒ Object
readonly
Returns the value of attribute assumptions.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#soundness ⇒ Object
readonly
Returns the value of attribute soundness.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, kind:, soundness:, description:, version: nil, assumptions: []) ⇒ AnalyzerProfile
constructor
A new instance of AnalyzerProfile.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, kind:, soundness:, description:, version: nil, assumptions: []) ⇒ AnalyzerProfile
Returns a new instance of AnalyzerProfile.
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 |
# File 'lib/necropsy/models.rb', line 814 def initialize(name:, kind:, soundness:, description:, version: nil, assumptions: []) ModelNormalization.identifier(name, 'analyzer profile name') kind = kind.to_sym if kind.respond_to?(:to_sym) soundness = soundness.to_sym if soundness.respond_to?(:to_sym) raise ArgumentError, "invalid analyzer kind: #{kind.inspect}" unless ANALYZER_KINDS.include?(kind) raise ArgumentError, "invalid analyzer soundness: #{soundness.inspect}" unless ANALYZER_SOUNDNESS.include?(soundness) unless description.is_a?(String) && !description.empty? && description.bytesize <= PROFILE_MAX_DESCRIPTION_BYTES raise ArgumentError, 'analyzer description must be a bounded non-empty string' end version = ModelNormalization.identifier(version, 'version') if version raise ArgumentError, 'analyzer version is too long' if version&.bytesize.to_i > PROFILE_MAX_VERSION_BYTES assumptions = ModelNormalization.string_list(assumptions, 'assumption') if assumptions.length > PROFILE_MAX_ASSUMPTIONS || assumptions.any? { |assumption| assumption.bytesize > PROFILE_MAX_ASSUMPTION_BYTES } raise ArgumentError, 'analyzer assumptions must be bounded' end super end |
Instance Attribute Details
#assumptions ⇒ Object (readonly)
Returns the value of attribute assumptions
793 794 795 |
# File 'lib/necropsy/models.rb', line 793 def assumptions @assumptions end |
#description ⇒ Object (readonly)
Returns the value of attribute description
793 794 795 |
# File 'lib/necropsy/models.rb', line 793 def description @description end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind
793 794 795 |
# File 'lib/necropsy/models.rb', line 793 def kind @kind end |
#name ⇒ Object (readonly)
Returns the value of attribute name
793 794 795 |
# File 'lib/necropsy/models.rb', line 793 def name @name end |
#soundness ⇒ Object (readonly)
Returns the value of attribute soundness
793 794 795 |
# File 'lib/necropsy/models.rb', line 793 def soundness @soundness end |
#version ⇒ Object (readonly)
Returns the value of attribute version
793 794 795 |
# File 'lib/necropsy/models.rb', line 793 def version @version end |
Class Method Details
.data_new ⇒ Object
795 |
# File 'lib/necropsy/models.rb', line 795 alias_method :data_new, :new |
.new(*values, **attributes) ⇒ Object Also known as: []
797 798 799 |
# File 'lib/necropsy/models.rb', line 797 def new(*values, **attributes) compatible_new(*values, **attributes) end |
Instance Method Details
#to_h ⇒ Object
836 837 838 839 840 841 842 843 844 845 |
# File 'lib/necropsy/models.rb', line 836 def to_h { 'name' => name.to_s, 'kind' => kind.to_s, 'soundness' => soundness.to_s, 'description' => description, 'version' => version, 'assumptions' => assumptions } end |