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
# encoding: utf-8 | |
def bar | |
catch(:calc) do | |
throw :calc , 100 | |
end | |
end | |
p bar | |
# => 100 |
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
# encoding: SJIS | |
p 1 | |
class Hoge | |
p 2 | |
end | |
p 3 |
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
# encoding: SJIS | |
class Foo | |
def initialize(a) | |
@a = a | |
end | |
def method1 | |
@a | |
end | |
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
# encoding: SJIS | |
class Hoge | |
def huga1; end | |
def huga2; end | |
alias :huga3 :huga1 | |
undef :huga2 | |
end | |
p Hoge.instance_methods(false) |
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
# encoding: SJIS | |
class Hoge | |
def method_missing(m,*args) | |
p "called:" + m.to_s | |
super # call original exception | |
end | |
end | |
Hoge.new.no_method |
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
true || y = 1 | |
p y # => nil |
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
File.join("/","g") # => /g | |
File.join("a","g") # => a/g | |
File.join("","g") # => /g | |
File.join("","g","") # => /g/ | |
File.join("","","g","") # => /g/ |
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
Ruby 既存ファイルを開く時のモードについて | |
"w" : 書き込みモード:既存ファイルの場合は、ファイルの内容を空にする。 | |
"w+": 読み書きモード:既存ファイルの場合は、ファイルの内容を空にする。 | |
"r+": 読み書きモード:ファイルの読み書き位置が戦闘になる。 | |
"a" : 追記モード :常にファイルの末尾に追加 | |
"a+": 読み書きモード:ファイルの読み込み位置は先頭。書き込み位置は常に末尾。 |
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
調べた英単語 | |
hoist [verb] | |
1. to raise (something) especially by using ropes or machinery | |
ロープなどを使って持ち上げる。 | |
2. drink (informal) | |
3. to take a shot , (basketball , informal) | |
使用例) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes | |
An important difference between function declarations and class declarations is that function declarations are hoisted and class declarations are not. |
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
https://github.com/goatslacker/alt/issues/283 | |
http://egorsmirnov.me/2015/08/16/react-and-es6-part3.html |