module FFaker::InternetSE
Constants
- BYTE
- DISPOSABLE_HOSTS
- DOMAIN_SUFFIXES
- HOSTS
- SLUG_DELIMITERS
Public Instance Methods
Source
# File lib/ffaker/internet_se.rb, line 82 def company_name_single_word CompanySE.name.split(' ').first end
Source
# File lib/ffaker/internet_se.rb, line 25 def disposable_email(name = nil) "#{user_name(name)}@#{fetch_sample(DISPOSABLE_HOSTS)}" end
Returns an email address of an online disposable email service (like tempinbox.com). you can really send an email to these addresses an access it by going to the service web pages.
Source
# File lib/ffaker/internet_se.rb, line 71 def domain_name "#{domain_word}.#{domain_suffix}" end
Source
# File lib/ffaker/internet_se.rb, line 86 def domain_suffix fetch_sample(DOMAIN_SUFFIXES) end
Source
# File lib/ffaker/internet_se.rb, line 75 def domain_word company_name_single_word.tap do |dw| dw.gsub!(/\W/, '') dw.downcase! end end
Source
# File lib/ffaker/internet_se.rb, line 18 def email(name = nil) +"#{user_name(name)}@#{domain_name}" end
Source
# File lib/ffaker/internet_se.rb, line 29 def free_email(name = nil) "#{user_name(name)}@#{fetch_sample(HOSTS)}" end
Source
# File lib/ffaker/internet_se.rb, line 98 def ip_v4_address (1..4).map { fetch_sample(BYTE) }.join('.') end
Source
# File lib/ffaker/internet_se.rb, line 66 def join_to_user_name(array_parts) join_char = fetch_sample(%w[. _]) array_parts.map(&:downcase).join(join_char) end
Source
# File lib/ffaker/internet_se.rb, line 34 def login_user_name user_name.tr('.', '') end
Used to fake login names were dot is not allowed
Source
# File lib/ffaker/internet_se.rb, line 102 def slug(words = nil, glue = nil) glue ||= fetch_sample(SLUG_DELIMITERS) (words || FFaker::Lorem.words(2).join(' ')).gsub(' ', glue).downcase end
Source
# File lib/ffaker/internet_se.rb, line 90 def uri(protocol) "#{protocol}://#{domain_name}" end
Source
# File lib/ffaker/internet_se.rb, line 39 def user_name(name = nil) return user_name_from_name(name) if name user_name_random end
Mostly used for email creation
Source
# File lib/ffaker/internet_se.rb, line 61 def user_name_from_name(name) array_parts = shuffle(name.scan(/\w+/)) join_to_user_name(array_parts) end
Source
# File lib/ffaker/internet_se.rb, line 45 def user_name_random rand(0..1).zero? ? user_name_variant_short : user_name_variant_long end
Source
# File lib/ffaker/internet_se.rb, line 49 def user_name_variant_long array_parts = [NameSE.first_name, NameSE.last_name] array_parts.map! { |word| word.gsub(/\W/, '') } join_to_user_name(array_parts) end
Source
# File lib/ffaker/internet_se.rb, line 55 def user_name_variant_short array_parts = [NameSE.first_name] array_parts.map! { |word| word.gsub(/\W/, '') } join_to_user_name(array_parts) end