This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2018-10-25T15:48:34.441Z","extensionVersion":"v3.2.0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = "Masha" | |
b = "Antonovich" | |
c = "37" | |
puts "Your name is " + a + " " + b + " and you are " + c + " years old." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_favorite_number = 9 | |
your_favorite_number = 1 | |
my_favorite_number + your_favorite_number = both | |
puts both |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first_number = 3 | |
puts first_number + second_number | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts 3 | |
puts 1 | |
put 4 | |
puts 1 | |
puts 5 | |
puts 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json.addresses @employee.addresses do |address| | |
if address.zip.length > 5 | |
json.line_1 address.line_1 | |
json.line_2 address.line_2 | |
json.city address.city | |
json.state address.state | |
json.zip address.zip | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100.times do | |
Employee.create( | |
:first_name => Faker::Name.first_name, | |
:last_name => Faker::Name.last_name, | |
:email => Faker::Internet.email, | |
:birthdate => Faker::Date.backward(50000), | |
:ssn => Faker::Code.ean, | |
) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
attr_reader :age, :job, :mood | |
def initialize(initial_age = "31", initial_job = "teacher", initial_mood = "content") | |
@age = initial_age | |
@job = initial_job | |
@mood = initial_mood |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
def age | |
puts "How old are you?" | |
@age = gets.chomp | |
return @age | |
end | |
def job | |
puts "What's your occupation?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
def initialize(initial_age = "31", initial_job = "teacher", initial_mood = "content") | |
@age = initial_age | |
@job = initial_job | |
@mood = initial_mood | |
puts "You must be #{@age} years old, work as a #{@job} and currently feel #{@mood} unless you've specified otherwise." | |
end |
NewerOlder