Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 02_Variables_Conditionals/starter_code/code_demo_boolean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@
#Let the computer do the work for you!

puts "Is 7 greater than 8?"
puts 7>8

puts "Is 8 x 77 greater than 600?"
puts (8*77) > 600

puts "Is 1 equal to (7 - 6)?"
puts 1 == (7-6)

puts "Is 77 greater than 50 AND (88 / 3) less than 30?"
puts (77 > 50) and (88/3 < 30)

puts "Is the length of the word 'wheelbarrow' more than 10 characters long?"
puts "wheelbarrow".length > 10

puts "Are the amount of seconds in an hour greater than or equal to 3000?"
puts (60*60) >= 3000

puts "Does the word 'slaughter' include the word laughter?"
puts "slaughter".include? "laughter"
19 changes: 18 additions & 1 deletion 02_Variables_Conditionals/starter_code/ex_teddit_conditional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Where you see comments (lines that begin with #) replace it with code so that the program works.

def get_input
#Get input from the user.
gets.strip
end

def calculate_upvotes(story, category)
Expand All @@ -16,6 +16,23 @@ def calculate_upvotes(story, category)

#For example:
# "Cats frolic despite tuna shortage" should give you 5 times the upvotes!

upvotes = 1

if story.downcase.include? "cat" or category.downcase.include? "cat"
upvotes = upvotes * 5
end

if story.downcase.include? "bacon" or category.downcase.include? "bacon"
upvotes = upvotes * 8
end

if category.capitalize == "Food"
upvotes = upvotes * 3
end

return upvotes

end

puts "Welcome to Teddit! a text based news aggregator. Get today's news tomorrow!"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#Apartment class.
class Apartment
attr_accessor :rent, :renter
attr_reader :name, :sqft, :bedrooms, :bathrooms

def initialize(name, sqft, bedrooms, bathrooms)
@name = name
@sqft = sqft
@bedrooms = bedrooms
@bathrooms = bathrooms
end

def to_s
"Name: #{@name}\n Square Feet: #{@sqft}\tBedrooms: #{@bedrooms}\tBathrooms: #{@bathrooms}\n"
end

end
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
#Building Class
class Building

attr_accessor :apartments, :num_units
attr_reader :address, :name

def initialize(name, address)
@name = name
@address = address
@apartments = []
end

def view_apartments
puts "-----------#{@name}-----------"
apartments.each do |unit|
puts unit
if unit.renter
puts "This apartment is rented"
else
puts "This apartment is vacant"
end
puts "*" * 50

end
end

def view_renters
puts "-----------#{@name} Renters List-----------"
apartments.each do |unit|
if unit.renter
puts "Name: #{unit.renter}\tApartment: #{unit.name}"
end
end
end


end
12 changes: 12 additions & 0 deletions 05_Classes_Objects/starter_code/ex_apartment_objects/lib/person.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#Person Class.
class Person

attr_accessor :name, :credit_score, :gender

def initialize(name, credit_score, gender)
@name = name
@credit_score = credit_score
@gender = gender
end

def to_s
"#{@name}"
end

end
5 changes: 4 additions & 1 deletion 05_Classes_Objects/starter_code/ex_apartment_objects/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require_relative 'lib/building'
require_relative 'lib/apartment'
require_relative 'lib/person'
require "pry"

## First, define our methods

Expand Down Expand Up @@ -83,11 +84,13 @@ def create_building
end
end

puts "What would you like to do next, (v)iew all apartments? (q)uit?"
puts "What would you like to do next, (v)iew all apartments? view all (r)enters? (q)uit?"
response = gets.strip

if response == 'v'
building.view_apartments
elsif response == 'r'
building.view_renters
else
puts "Thanks for using Ruby Building Manager"
end
48 changes: 24 additions & 24 deletions 11_Lab_Session/slides/slides_11.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
![GeneralAssemb.ly](https://github.com/generalassembly/ga-ruby-on-rails-for-devs/raw/master/images/ga.png "GeneralAssemb.ly")
#BEWD - Review Lab Session
###Instructor Name
---
##Agenda
![GeneralAssemb.ly](https://github.com/generalassembly/ga-ruby-on-rails-for-devs/raw/master/images/ga.png "GeneralAssemb.ly")

#BEWD - Review Lab Session

###Instructor Name

---


##Agenda

* Review
* Lab Time

---
---


##Review
###Request-response

![Request Response Diagram](../../assets/rails/response_request.png)

---



---



##Review
###Routes, Views, Controllers and Forms

Instructors, you know your class best. What do your students need to review?

---




<img id ='icon' src="../../assets/ICL_icons/Exercise_icon_md.png">
<img id ='icon' src="../../assets/ICL_icons/Exercise_icon_md.png">
##Lab Time

####Ritly
60 min

####Rewsly
45 min

---


## Homework

## Homework

Complete Rewsly

---

Loading