Class: WebsiteWorth::User

Inherits:
Object
  • Object
show all
Defined in:
lib/website_worth/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ User

responsible for providing his/her name and the necessary info to scrape



7
8
9
10
11
12
13
# File 'lib/website_worth/user.rb', line 7

def initialize(name)
  if name == ""
    @name = "User"
  else
    @name = name[0].upcase + name[1..-1].downcase
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/website_worth/user.rb', line 4

def name
  @name
end

Class Method Details

.gives_a_site_nameObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/website_worth/user.rb', line 15

def self.gives_a_site_name
  while true
    user_choice = gets.chomp.downcase.to_s
    if user_choice == ""
      print "\nPlease enter a valid website name: "
      next
    else
      break
    end
  end
  user_choice
end