Skip to content

Instantly share code, notes, and snippets.

# encoding: utf-8
# File Name: date.rb
# Create Day is 2015/05/22
# Last Update Day is 2015/05/22
# Require List
require 'date'
puts "Dateクラス"
# encoding: utf-8
# File Name: time.rb
# Create Day is 2015/05/22
# Last Update Day is 2015/05/22
puts "Timeクラス"
time = Time.now
puts time
!!!
%html{:lang => "ja"}
%head
%title= @title
%meta{:content => "text/html", :"http-equiv" => "Content-Type", :charset => "utf-8"}
%body
%h1 #{@title}
# encoding: utf-8
# File Name: sinatra_start.rb
# Create Day is 2015/05/20
# Last Update Day is 2015/05/20
# Gem List
gem 'tilt', '1.4.1'
# Require List
require 'sinatra'
!!!
%html{:lang => "ja"}
%head
%title Request Print
%body
%p リクエストのHTTPメソッドと実行パス
%p
= "method = #{@request_method}"
= "url = #{@request_url}"
!!!
-# %TagName(html)で記述
%html{:lang => "ja"}
%head
-# 「%TagName= @EmmbeddingName」で出力
%title= @title
%body
-# 「%TagName #{@EmmbeddingName}で出力」
%h1 #{@title}
%p= @text
# encoding: utf-8
# File Name: sinatra_test.rb
# Create Day is 2015/05/08
# Last Update Day is 2015/05/14
# Gem List
gem 'tilt', '1.4.1'
# Require List
require 'sinatra'
# encoding: utf-8
# File Name: main4.rb
# Create Day is 2015/05/17
# Last Update Day is 2015/05/17
# その他
class SuperOther
def initialize(private_text="private", protected_text="protected", public_text="public")
@private_text = private_text
# encoding: utf-8
# File Name: main3.rb
# Create Day is 2015/05/17
# Last Update Day is 2015/05/17
# モジュール
module ModuleTest
def test_method
puts "test1"
# encoding: utf-8
# File Name: main2.rb
# Create Day is 2015/05/17
# Last Update Day is 2015/05/17
# スーパークラス
class SuperClass
# 初期化関数
def initialize