This file contains hidden or 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 debug_line(*list) | |
| ret = "Debug: " | |
| 0.step(list.length, 2) do |x| | |
| label, value = list[x,x+1] | |
| ret += "#{label} = '#{value}', " | |
| end | |
| puts ret | |
| end | |
| debug_line("a", 10, "b", 20) |
This file contains hidden or 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 'rubygems' | |
| require 'sinatra' | |
| data = "none" | |
| before do | |
| content_type 'text/plain', :charset => 'utf-8' | |
| request.env['PATH_INFO'].gsub!(/\/$/,'') | |
| end |
This file contains hidden or 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
| tog_data = "house" | |
| get '/one/:word' do | |
| tog_data = "mouse" # This works and sets tog_data to "mouse" | |
| end | |
| get '/two/:word' do | |
| tog_data = params[:word] # This does not work, tog_data becomes private | |
| end |