class DataMetaPii::RegKeyVo
PII Registry Key Value Object, encapsulates the PII Registry Key with attributes @!attribute [r] key
@return [String] unique key for the given enum
@!attribute [r] level
@return [Symbol] the impact level
Constants
- LEVEL
The map key for the level
Attributes
attrs[RW]
key[RW]
level[RW]
Public Class Methods
new(key, attrs)
click to toggle source
Creates an instance for the given parameters, see the properties with the same names.
# File lib/dataMetaPii.rb, line 135 def initialize(key, attrs) @key, @attrs = key, attrs # single the level out: levelSpec = attrs[LEVEL] raise ArgumentError, %<Impact level missing or empty in #{@attrs.inspect}> unless levelSpec && !levelSpec.empty? @level = levelSpec.to_sym raise ArgumentError, %<Unsupported Impact Level #{@attrs.inspect}. Supported levels are: #{ ALL_IMPACTS.map(&:to_s).join(', ')}> unless ALL_IMPACTS.member?(@level) raise ArgumentError, %<Invalid PII key: "#{@key}"> unless @key =~ /^\w+$/ end
Public Instance Methods
to_s()
click to toggle source
textual representation of this instance
# File lib/dataMetaPii.rb, line 151 def to_s; "#{key}(#{@level})" end
to_tree_image(indent = '')
click to toggle source
Builds a textual tree image for logging and/or console output
# File lib/dataMetaPii.rb, line 154 def to_tree_image(indent = '') next_ident = indent + DataMetaPii::INDENT %<#{indent}#{@key}: #{next_ident}#{@attrs.keys.map{|k| "#{k}=#{@attrs[k]}"}.join("\n#{next_ident}")}> end