-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
104 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
%form{action: '/TASKS'.downcase} Rubyスクリプトを解釈する | ||
%form(action='/tasks') HTML属性風の指定 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
require 'rack' | ||
require './sinatra_modular' | ||
|
||
class RackApplication | ||
def call(env) | ||
[200, {'Content-Type' => 'text/plain'},['Hello!']] | ||
end | ||
end | ||
|
||
run RackApplication.new | ||
run Application |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.error | ||
エラー | ||
#error_message | ||
エラーメッセージ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.foo_class.bar_class | ||
hi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
%ul | ||
- %w(alice bob carol).each do |name| | ||
%li | ||
= name |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
%hml | ||
%body | ||
%h1.error エラーメッセージ | ||
%p#error_message | ||
エラー内容 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'sinatra' | ||
|
||
get '/' do | ||
'Classic Style Sinatra!' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'sinatra' | ||
|
||
configure do | ||
puts 'default configure' | ||
end | ||
|
||
configure :production do | ||
puts 'production configure' | ||
end | ||
|
||
configure :development, :test do | ||
puts 'development,test configure' | ||
end | ||
|
||
get '/' do | ||
'configure sample' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'sinatra' | ||
|
||
get '/' do | ||
puts "settings.production? => #{settings.production?}" | ||
puts "settings.development? => #{settings.development?}" | ||
puts "settings.test? => #{settings.test?}" | ||
|
||
"configure sample" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'sinatra/base' | ||
|
||
class Application < Sinatra::Base | ||
get '/' do | ||
'Modular Style Sinatra!' | ||
end | ||
end | ||
|
||
#Application.run! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'sinatra' | ||
|
||
get '/' do | ||
puts "params => #{params}" | ||
puts "params.class => #{request.inspect}" | ||
puts "request => #{request.class.ancestors}" | ||
|
||
'request sample' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'sinatra' | ||
|
||
get '/' do | ||
'response sample' | ||
end | ||
|
||
get '/response' do | ||
status 404 | ||
headers 'Content-Type' => 'text/plain' | ||
body 'response sample' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'sinatra' | ||
|
||
get '/:name' do | ||
"Hi #{params[:name]}" | ||
end | ||
|
||
get '/profile' do # こちらには処理が到達しない | ||
'profile' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'sinatra' | ||
|
||
get '/' do | ||
erb :index | ||
end | ||
|
||
__END__ | ||
|
||
@@ index | ||
<html> | ||
<body> | ||
<h1>Ruby Version = <%= RUBY_VERSION %></h1> | ||
</body> | ||
</html> |