Ruby
shokos Advent Calendar 2012äºæ¥ç®æ¨æ¥ã¤ãã£ãActiveAdminã§ä½ã£ãã¢ããªã®indexç»é¢ãããã¦ãªãã®ã§ç·¨éãã¾ããapp/admin/schedules.rb ãéã㦠# encoding: utf-8 ActiveAdmin.register Schedule do index do column "äºå®", :plan column "æ¥æ", :oâ¦
shokos Advent Calendar 2012ä¸æ¥ç®rails ActiveAdminã§ããããCRUDãã¤ããï¼ Active Admin | The administration framework for Ruby on Railsã¹ã±ã¸ã¥ã¼ã«ç®¡çã¢ããªãPopuraãã¤ããã¾ããã rails new Popura ãã¼ã£ã¨ãã¡ã¤ã«ããã©ã«ããä½ãããã¤â¦
æ¸ãããã§æ¾ç½®ãã¦ããã®ãå®æããã¾ãã class HQ9Plus def initialize(source) @source = source @count = 0 end def run @source.each_char do |c| case c when "H" hello when "Q" source when "9" bottles when "+" count end end end private def heâ¦
Rubyã®åå¼·ãã£ã¨ã¾ããã«ãããã¼ï¼ã³ã³ã¹ãã©ã¯ã¿ã®æ¸ãæ¹ã¨ããå¼æ°ã®æ±ãæ¹ã¨ããcaseãwhenæã¨ããã¤ã³ã¹ã¿ã³ã¹ã®æã¡æ¹ã¨ãå¦ãã ã®ã§ãã¾ã éä¸ã ãã©ä¸æ¦æä¸ãã¾ãã class HQ9Plus def initialize(source) @source = source end def run case @soâ¦
foræã¨ifæã®æ¸ãæ¹è¦ããï¼ããããã®ã§ãfizzbuzzåé¡ãããããªæ¸ãæ¹ã§æ¸ãã¦ã¿ãã for number in (1..100) if number%15 == 0 puts("fizzbuzz") elsif number%5 == 0 puts("buzz") elsif number%3 == 0 puts("fizz") else puts("#{number}") end end â¦