Class: Pseudonymize::Ip

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip, **options) ⇒ Ip

Returns a new instance of Ip.



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

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

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#resultObject



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

def result
  first = @ip.split('.')[0..-2].join('.')
  "#{first}.#{options[:censor] * 3}"
end