class Cased::Sensitive::Range

Attributes

begin_offset[R]

Public: The beginning offset of the sensitive value in the original value.

end_offset[R]

Public: The end offset of the sensitive value in the original value.

identifier[R]

Public: This is the identifier that groups sensitive ranges together. This could be an identifier to an individual for example.

key[R]

Public: The JSON key.

label[R]

Public: The human label describing what sensitive information was label. Username, email, date of birth, etc.

Public Class Methods

new(label: nil, key:, begin_offset:, end_offset:, identifier: nil) click to toggle source
# File lib/cased/sensitive/range.rb, line 23
def initialize(label: nil, key:, begin_offset:, end_offset:, identifier: nil)
  raise ArgumentError, 'missing key' if key.nil?
  raise ArgumentError, 'missing begin_offset' if begin_offset.nil?
  raise ArgumentError, 'missing end_offset' if end_offset.nil?

  @label = label
  @key = key
  @identifier = identifier
  @begin_offset = begin_offset
  @end_offset = end_offset
end

Public Instance Methods

==(other) click to toggle source
# File lib/cased/sensitive/range.rb, line 35
def ==(other)
  @begin_offset == other.begin_offset &&
    @end_offset == other.end_offset &&
    @label == other.label &&
    @key == other.key &&
    @identifier == other.identifier
end
to_h() click to toggle source
# File lib/cased/sensitive/range.rb, line 43
def to_h
  {
    begin: @begin_offset,
    end: @end_offset,
  }.tap do |hash|
    hash[:label] = label if label
    hash[:identifier] = identifier if identifier
  end
end