Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week 9 materials #9

Merged
merged 3 commits into from
Dec 5, 2014
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
/*/.DS_Store
/*/*/.DS_Store
/*/doc/*
.ruby-version
.ruby-gemset
36 changes: 36 additions & 0 deletions week9/exceptions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class ReneeError < Exception

def message
"Renee breaks everything"
end

end


def hello
begin
raise ReneeError.new
puts yield
rescue LocalJumpError => e
puts e
rescue ReneeError => e
puts e
puts "Don't let Renee near your code"
ensure
puts "you ran the hello method"
end


catch :renee_error do
puts "before throw"
throw :renee_error
puts "after throw"
end

puts "outside of catch"

end

hello { " Hello World " }

hello
23 changes: 23 additions & 0 deletions week9/rdoc_demo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class HeadGear
end

# This is a really cool Hat class
#
# Author:: Renée Hendricksen
# License:: MIT
#
# This is more info about the class
class Hat < HeadGear

attr_accessor :color, :size

# This is the constructor
# * size : The size of the Hat
# * color : The color of the Hat
def initialize color, size
@color = color
@size = size
end


end
19 changes: 19 additions & 0 deletions week9/sinatra_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'sinatra'
require 'thin'

get '/hello' do
hello do |time|
"<html><body><font color='pink'>Hello World</font><br/>
The time is: #{time}
</body></html>"
end
end

get '/' do
"<html><body><a href='/hello'>hello link</a></body></html>"
end

def hello
time = Time.now
yield time
end
Binary file added week9/week9.key
Binary file not shown.
Binary file added week9/week9.pdf
Binary file not shown.