2015-12-01ãã1ã¶æéã®è¨äºä¸è¦§
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®25æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã®ååä»ãå¼æ°ã®ä¾ã§ãã def hoge(a, b=1, c: 2) p [a, b, c] end hoge(123) #=> [123, 1, 2] hoge(123, 456) #=> [123, 456, 2] hoge(123, c: 789) #=> [123â¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®24æ¥ç®ã®è¨äºã§ãã qiita.com Crystal ã®ã½ã¼ã¹ã³ã¼ã㯠Crystal ã§è¨è¿°ããã¦ãã¾ããæå㯠Ruby ã§æ¸ããã¦ããããã§ãããç¾å¨ã¯ãã¹ã¦ Crystal ã§æ¸ããã¦ãã¾ãã Ruby ã¯æ¬ä½ã¨çµã¿è¾¼ã¿ã©â¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®23æ¥ç®ã®è¨äºã§ãã qiita.com ã¡ã½ããã«æ¸¡ããããããã¯ãå®è¡ããã«ã¯æ¬¡ã®2ã¤ã®æ¹æ³ãããã¾ãã def hoge yield end hoge{ p 123 } def hoge(&block) block.call end hoge{ p 123 } ã§ãããâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®22æ¥ç®ã®è¨äºã§ãã qiita.com ã¿ã¤ãã«ã®ã¾ãã¾ã§ãããCrystal 㯠Thread ããªãã¦ã¤ããã Thread ã¨ããã¯ã©ã¹ã¯ããã¾ãããã½ã¼ã¹ãè¦ãã¨ã # Don't use this class, it is used internallyâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®21æ¥ç®ã®è¨äºã§ãã qiita.com Crystal ã® String 㯠UTF-8 åºå®ãªã®ã§ãã¤ããªãã¼ã¿ã String ã§æ±ããã¨ã¯ã§ãã¾ããã ãã¤ããªãã¼ã¿ãæ±ãã«ã¯ String ã§ã¯ãªã Slice ã使ãã¾ãã Slice(UIâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®20æ¥ç®ã®è¨äºã§ãã qiita.com æ¨æ¥ã®è¨äºã§ãFile#gets ã nil ãè¿ããã¨ãããã®ã§ã line = File.open("/dev/urandom").gets if line.is_a? String # gets 㯠nil ãè¿ããã¨ããããããã® ifâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®19æ¥ç®ã®è¨äºã§ãã qiita.com æ¨æ¥ã®è¨äºã§ Crystal ã®æåå㯠UTF-8 ã ã¨æ¸ãã¾ããããå®è¡æã«å¤é¨ãã UTF-8 以å¤ã®æååãä¸ããã¨ã©ããªãã®ã§ããããã p File.open("/dev/urandom").geâ¦
ãã㯠NSEG Advent Calendar ã® 18æ¥ç®ã®è¨äºã§ãã www.adventar.org 5æããè¡ã£ã¦ãããçè«ããå¦ã¶ãã¼ã¿ãã¼ã¹å®è·µå ¥éãã®èªæ¸ä¼ã 12/16 ã«ãã§ããæçµåãè¿ãã¾ããã å ¨é¨ã§15åï¼ã¹ãã·ã£ã«åãå ¥ããã¨16åï¼ã§ããã ä¸äººã§1ã2ãã¼ã¸é³èªãâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®18æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã®æååã®ã¨ã³ã³ã¼ãã£ã³ã°ã¯ãªãã¸ã§ã¯ãæ¯ã«ç°ãªãå¯è½æ§ãããã¾ãã ã¨ã³ã³ã¼ãã£ã³ã°ãç°ãªãæååãçµåããããããã³ã°ããããã¨ããã¨ä¾å¤ã«ãªãã¾â¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®17æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã§ã¯ 'ã' 㨠"ã" ã¯ä¸¡æ¹ã¨ãæåå(String)ã§ããæååã1æåãã¤ã«åå²ãã¦ããããã¯1æåã®æååã§ãã Crystal ã§ã¯ 'ã' ã¯æå(Char)ã§ã"ã" ã¯æâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®16æ¥ç®ã®è¨äºã§ãã qiita.com æè¿ Ruby ã§ãªãã©ã«æååãå¤æ´ä¸å¯ã«ããã¨ãããªãã¨ãã£ã¦è©±ãããã¾ãããCrystal ã®æååã¯æåããå¤æ´ä¸å¯ã§ãã æååãªãã¸ã§ã¯ããå¤æ´ãããããªã¡â¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®15æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã® String#to_i ã¯æ°å以å¤ã®æååã®å ´åã« 0 ãè¿ãã¾ããC ã® atoi() ã¨åãã§ãã % ruby -e 'p "abc".to_i' 0 Crystal ã® String#to_i ã¯æ°å以å¤ã®æååâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®14æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã§ã¯ nil.to_i 㯠0 ã«ãªãã¾ãããCrystal ã§ã¯ã³ã³ãã¤ã«æã¨ã©ã¼ã«ãªãã¾ãã % crystal eval 'nil.to_i' Error in line 1: undefined method 'to_i' for Niâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®13æ¥ç®ã®è¨äºã§ãã qiita.com æ¨æ¥ã®è¨äºã«æ¸ããããã« Crystal ã¯å¤æ°ãåæåããã«å®£è¨ã ããããã¨ãã§ãã¾ãã ã§ããã宣è¨ã ãã ã¨å¤ã¯æªå®ç¾©ã§ããæªå®ç¾©ã®ã¾ã¾åç §ããã¨ä¾å¤ãçºçããâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®12æ¥ç®ã®è¨äºã§ãã qiita.com Crystal 㧠Ruby ã¨åããããªæè¦ã§ã¤ã³ã¹ã¿ã³ã¹å¤æ°ã使ã㨠nil ã ã¨æããããã¨ãããã¾ãã class Hoge def hoge @hoge = "abc" @hoge.size end end Hoge.new.â¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®11æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã«ã¯åãæ©è½ãªã®ã«è¤æ°ã®ååãããã¡ã½ãããããã¾ãããCrystal ã¯åºæ¬çã«1æ©è½ã«1ã¡ã½ããåã¨ããæ¹éã®ããã§ãã ããã«ãã Ruby ã«ã¯ããã®ã« Crystâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®10æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã ã¨ãé åãå±éãã¦ã¡ã½ããã®å¼æ°ã«ãããã¨ãã§ãã¾ãã arg = [1, "abc", :foo] hoge(*arg) # hoge(1, "abc", :foo) ã¨åã Crystal ã ã¨ããã¯ã§ãã¾ããâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®9æ¥ç®ã®è¨äºã§ãã qiita.com æ¨æ¥ã®è¨äºã«ãTuple ã使ãã¨ããã¡ãã§ããã¨ããã³ã¡ã³ãããããã¾ããã ã¿ãã«ã使ã£ã¦æ¸ããªããã¦ã¿ã¾ãã [ { 1, "hoge" }, { 2, "fuga" }, { 3, "piyo" }, â¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®8æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã ã¨ãããã°ã©ãã¼ãé åã®1çªç®ã®è¦ç´ ã¯æ´æ°ã§ã2çªç®ã®è¦ç´ ãæååã§â¦ã¨ãã£ãããã«æ±ºãã¦ã次ã®ãããªã³ã¼ããæ¸ããããããã¨ãããã¾ãã [ [ 1, "hogeâ¦
ãã㯠NSEG Advent Calender ã®7æ¥ç®ã®è¨äºã§ã(å 容㯠NSEG ã¨ãé·éã¨ãé¢ä¿ããã¾ãããâ¦)ã www.adventar.org ã¡ã¼ã«ã®éä¿¡è (From)ã件å(Subject)ã¯æ¬æ¥ASCII(ã®ä¸é¨ã®æå)ããæ¸ããã¨ãã§ããªããã§ãããMIME(RFC2047)ã®ç»å ´ã«ãã£ã¦æ¥æ¬èªçã®éâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®7æ¥ç®ã®è¨äºã§ãã qiita.com Crystal ãä½ã®æ°ç¡ãã«ä½¿ã£ã¦ããã¨ãæ°ãã¤ã㨠.crystal ã¨ãããã£ã¬ã¯ããªããã¡ãã¡ã«ã§ãã¦ãã¾ãã Crystal ã¯ã³ã³ãã¤ã«æã« .crystal ã¨ãããã£ã¬ã¯ããªãâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®6æ¥ç®ã®è¨äºã§ãã qiita.com 1æ¥ç®ã®è¨äºã§é åãèªåæ¡å¼µãããªãã¦ã¤ããã¨æ¸ãããã§ãããé åã®ç¯å²å¤ã®åç §ãã¨ã©ã¼ã«ãªãã¾ãã array = [0, 1, 2] array[3] [4337095] *CallStack::unwindâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®5æ¥ç®ã®è¨äºã§ãã qiita.com 5æ¥ç®ã«ãã¦æ¢ã«ãã¿åãã§ãã Ruby ã¯é¢ä¿ãªããã¤ããããªããã§ããã©ãCrystal ã¢ããã³ãã«ã¬ã³ãã¼ã§æ¥æ¬èªããã¥ã¡ã³ãããããã¨ãç¥ãã¾ããã www.adventaâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®4æ¥ç®ã®è¨äºã§ãã qiita.com æ¨æ¥ã®è¨äºã§ãCrystal ã¯æ·±ããä¸å®ã®é åãä½ããªãã¦ã¤ããã¨æ¸ãããã§ããã å®éã«ã§ããªããããªãã ããããæ¹æ³ã調ã¹ã¦4æ¥ç®ã®è¨äºã«ãããã¨æã£ã¦ãã¨ãâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®3æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã®é åã¯ä»»æã®åã®ãªãã¸ã§ã¯ããå ¥ãã¾ãããCrystal ã¯ç¹å®ã®åããå ¥ãã¾ããã 空é åãä½ããã¨ããã¨ã¨ã©ã¼ã«ãªãã¾ãã array = [] #=> Syntax error inâ¦
çè«ããå¦ã¶ãã¼ã¿ãã¼ã¹å®è·µå ¥é ~ãªã¬ã¼ã·ã§ãã«ã¢ãã«ã«ããå¹ççãªSQL (WEB+DB PRESS plus)ä½è :奥é å¹¹ä¹çºå£²æ¥: 2015/03/10ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼ 11/28 ã« NSEG 第69ååå¼·ä¼ã¨ãã¦ãçè«ããå¦ã¶ãã¼ã¿ãã¼ã¹å®è·µå ¥éãèªæ¸ä¼ã¹ãã·ã£â¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®2æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã ã¨å®è¡æã«ã¨ã©ã¼ãçºçããã¨ãã¨ã©ã¼ãçºçããããã°ã©ã ã®ä½ç½®ãåºåãããã®ã§ããã def hoge raise "hoge" end hoge % ruby hoge.rb hoge.rb:2:in `hogâ¦
ããã¯ãRubyè³ã«ã¯Crystalã¤ãã Advent Calendar 2015ãã®1æ¥ç®ã®è¨äºã§ãã qiita.com Ruby ã ã¨é åã®ç¯å²å¤ã«å¤ãä»£å ¥ããã¨ã array = [0, 1, 2] array[4] = 4 array #=> [0, 1, 2, nil, 4] ã®ããã«ãé åãèªåæ¡å¼µãããã®ã§ãããCrystal ã§åããâ¦