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
module Echoer | |
def echoes(*phrases) | |
@known_phrases.concat(phrases) | |
@known_phrases.each do |phrase| | |
next if self.respond_to?(phrase.to_sym) | |
define_method("#{phrase}") { phrase.to_s } | |
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
module Motion | |
def default_movement | |
"walking" | |
end | |
end | |
module Flight | |
extend Motion | |
def movement |
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
module StringLookup | |
def self.lookup(string) | |
case string | |
when /^Foo.*$/ then 'group A' | |
when /^F.*$/ then 'group B' | |
when /^Bar.*$/ then 'group C' | |
when /^Baz.*$/ then string.gsub('a', '0') | |
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
require 'sinatra/base' | |
class GetServer < Sinatra::Base | |
set :logging, nil | |
get '/' do | |
puts "count: #{params["request_number"]}" | |
end | |
end |