Class: Pseudonymize::Name

Inherits:
Object
  • Object
show all
Defined in:
lib/pseudonymize/name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, **options) ⇒ Name

Returns a new instance of Name.



5
6
7
8
# File 'lib/pseudonymize/name.rb', line 5

def initialize(name, **options)
  @name    = name
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/pseudonymize/name.rb', line 3

def options
  @options
end

Instance Method Details

#resultObject



10
11
12
13
14
# File 'lib/pseudonymize/name.rb', line 10

def result
  @name.split.map do |name|
    "#{name[0]}#{options[:censor] * (name.length - 1)}"
  end.join(' ')
end