Module: Zarby

Defined in:
lib/zarby.rb,
lib/zarby/csv.rb,
lib/zarby/errors.rb,
lib/zarby/version.rb,
lib/zarby/anonymize.rb,
lib/zarby/functions.rb,
lib/zarby/normalize.rb,
sig/zarby.rbs

Defined Under Namespace

Modules: Functions Classes: ArgumentZarby, ColSeparatorZarby, Csv, Foo, Normalize

Constant Summary collapse

VERSION =

Returns:

  • (String)
"0.2.2"

Class Method Summary collapse

Class Method Details

.anonymize(input, nb_chars: 2, mask_with: "*") ⇒ String

Anonymizes a given input by masking the first nb_chars characters with mask_with.

Parameters:

  • input (String)

    The string input to be anonymized.

  • nb_chars (Integer) (defaults to: 2)

    The number of characters from the input to be masked. Default is 2.

  • mask_with (String) (defaults to: "*")

    The character to mask the input with. Default is '*'.

Returns:

  • (String)

    The anonymized string with masked characters.



28
29
30
# File 'lib/zarby.rb', line 28

def anonymize(input, nb_chars: 2, mask_with: "*")
  Anonymize.new(input:, nb_chars:, mask_with:).call
end

.detect_separator(content) ⇒ String

Detects and returns the separator used in the provided CSV content.

Parameters:

  • content (String)

    The CSV content to detect the separator for.

Returns:

  • (String)

    The detected separator (e.g., ',' or ';').



36
37
38
# File 'lib/zarby.rb', line 36

def detect_separator(content)
  Csv.new(content:).call
end

.plopObject



9
10
11
12
13
14
# File 'lib/zarby.rb', line 9

def plop
  zp "coucou ca va?"
  puts inspect
  puts self.class.inspect
  puts self.class.name
end

.utf8(input) ⇒ String

Normalizes the input string to UTF-8 encoding.

Parameters:

  • input (String)

    The input string to normalize.

Returns:

  • (String)

    The normalized string in UTF-8 encoding.



44
45
46
# File 'lib/zarby.rb', line 44

def utf8(input)
  Normalize.new(input:).call
end