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
require 'pry' | |
require 'pry-nav' | |
class Person | |
def initialize(att) | |
self.class.class_eval do | |
att.each do |method, value| | |
define_method(method) do | |
instance_variable_get("@#{method}") | |
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
# All bicycles are road bikes | |
# A Mechanic is going to need to know what spare parts to take | |
# for a bike on a trip in case it breaks down | |
# tape color is the only dynamic component of spares | |
############## Page 107 ############## | |
class Bicycle | |
attr_reader :size, :tape_color | |
def initialize(args) | |
@size = args[:size] |
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 person should be able to purchase a ticket to a show | |
they should be able to attend multiple shows | |
we should keep track of how many unused tickets a person has | |
we should keep track of how many used tickets a person has | |
we should be able to use a ticket (go to a show) |
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
Alexander Burton | |
Andrew Persad | |
Brian Mesa | |
Bruna Netto | |
Carson Crane | |
Christopher Dabalsa | |
Damian Lajara | |
Djavan Joseph | |
Dylan O'Keefe | |
Esther Mohadeb |
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
require 'pry' | |
def second_supply_for_fourth_of_july(holiday_hash) | |
# given that holiday_hash looks like this: | |
# { | |
# :winter => { | |
# :christmas => ["Lights", "Wreath"], | |
# :new_years => ["Party Hats"] | |
# }, | |
# :summer => { |
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
def reformat_languages(languages) | |
result = {} | |
languages.each_pair do |style, values| | |
# style like :oo | |
# values like { | |
# :javascript => { | |
# :type => "interpreted" | |
# } | |
values.each_pair do |language, attributes| | |
# language is like :javascript |
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
def reformat_languages(languages) | |
result = {} | |
languages.each_pair do |style, values| | |
# style like :oo | |
# values like { | |
# :javascript => { | |
# :type => "interpreted" | |
# } | |
values.each_pair do |language, attributes| | |
# language is like :javascript |
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
require 'pry' | |
require 'pry-nav' | |
require 'ap' | |
pigeon_data = { | |
:color => { | |
:purple => ["Theo", "Peter Jr.", "Lucky"], | |
:grey => ["Theo", "Peter Jr.", "Ms. K"], | |
:white => ["Queenie", "Andrew", "Ms. K", "Alex"], | |
:brown => ["Queenie", "Alex"] |
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
# Count words in a sentence | |
require 'pry-nav' | |
require "pry" | |
require 'ap' | |
paragraph = <<-something | |
Steven likes the movies. Blake likes to ride his bike but hates movies. | |
Blake is taller than steven. Steven is a great teacher. | |
something |
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
sentence = <<-something | |
Steven likes the movies. Blake likes to ride his bike but hates movies. | |
Blake is taller than steven. Steven is a great teacher. | |
something | |
sentence = sentence.gsub("."," ") # you can chain more then one gsub | |
sentence = sentence.split(" ").collect {|word| word.capitalize} | |
cont = {} |