Class: ParseNameFromEmail::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/parse_name_from_email/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/parse_name_from_email/configuration.rb', line 5

def initialize
  # split email address with regexp (test: https://regex101.com/r/pF5mS4)
  @regexp = /(?=[A-Z])|(?:([0-9]+))|\.|-|\?|!|\+|\;|\_/

  ## Recognizing plus parts in gmail addresses
  #
  # DEFAULT: true
  #
  # if TRUE:
  #   email address:  '[email protected]'
  #   result name:    'Example (Something 123)'
  #
  # if FALSE:
  #   email address:  '[email protected]'
  #   result name:    'Example'
  @friendly_plus_part = true
end

Instance Attribute Details

#friendly_plus_partObject

Returns the value of attribute friendly_plus_part.



3
4
5
# File 'lib/parse_name_from_email/configuration.rb', line 3

def friendly_plus_part
  @friendly_plus_part
end

#regexpObject

Returns the value of attribute regexp.



3
4
5
# File 'lib/parse_name_from_email/configuration.rb', line 3

def regexp
  @regexp
end

Class Method Details

.regex_for_validation_format_as_rfcObject



27
28
29
# File 'lib/parse_name_from_email/configuration.rb', line 27

def self.regex_for_validation_format_as_rfc
  /(\<[\S]*[\S]*\.[\S]*\>)/
end

.regexp_to_split_by_rfcObject



23
24
25
# File 'lib/parse_name_from_email/configuration.rb', line 23

def self.regexp_to_split_by_rfc
  /(\<|\>)/
end