Skip to content

Instantly share code, notes, and snippets.

@barnes7td
Last active December 16, 2015 08:28
Show Gist options
  • Save barnes7td/5405576 to your computer and use it in GitHub Desktop.
Save barnes7td/5405576 to your computer and use it in GitHub Desktop.
Ruby challenge for the "faker" gem
require 'faker'
class Person
include Faker
attr_reader :first_name, :last_name, :phone_number, :work_address, :bio, :email
def initialize
@first_name = Name.first_name
@last_name = Name.last_name
@phone_number = PhoneNumber.phone_number
@work_address = "#{Address.street_address}, #{Address.city}, #{Address.state_abbr}, #{Address.zip}"
@bio = Lorem.paragraph(3)
@email = Internet.email
end
# This about_me method uses a Heredoc designated with <<-ABOUT....ABOUT
def about_me
print <<-ABOUT
Hello, my name is #{first_name} #{last_name}
A little about me: #{bio}
You can reach me at:
Phone: #{phone_number}
Email: #{email}
Work: #{work_address}
ABOUT
end
## Alternative about_me method
def about_me
puts "Hello, my name is #{first_name} #{last_name}"
puts "A little about me: #{bio}"
puts "You can reach me at: "
puts "Phone: #{phone_number}"
puts "Email: #{email}"
puts "Work: #{work_address}"
end
end
Person.new.about_me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment