Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
æ¬è¨äºã¯è±èªçããã°ã§å ¬éãããè¨äºã®ç¿»è¨³çã§ãã ããã©ã¼ãã³ã¹ã¯ã©ããªã¢ããªã±ã¼ã·ã§ã³éçºè ã«ã¨ã£ã¦ã大ããªæ¸å¿µã§ããåé¡ãªã®ã¯ã人ã¯å¾ã ã«ãã¦ãå®éã«ããã©ã¼ãã³ã¹ãä¸ããã¯ããæ¸å¿µãã¹ãäºæ ã«ãªãã¾ã§åé¡ãæ¾ç½®ããã¡ã ã¨ããç¹ã§ããããã©ã¼ãã³ã¹å¯¾çã¯åãã£ã¦è¬ãã¦ããã¹ããã®ã§ãã»ããã³ãåºã¯ããã¦ããåããããã®ã§ã¯é ããã¾ãããã¾ã®ã¬ãã¥ã¼ã§æ¸ã¾ããã®ã§ã¯ãªããããã»ã¹ã®ä¸ç°ã«çµã¿è¾¼ããã¨ãå¿ è¦ã§ãããã®è¨äºã§ã¯ãããã©ã¼ãã³ã¹åä¸ã®ããã«éçºè ãèªåã§ã§ããããã¤ãã®å¯¾çã«ã¤ãã¦è¦ã¦ããã¾ããã¾ãã¯ãã¼ã¿ãã¼ã¹ã§ãã ãã¼ã¿ãã¼ã¹ã®ããã©ã¼ãã³ã¹ Railsã使ãå ´åãActiveRecordãDataMapperã¨ãã£ãORMã使ãã°ã¢ããªã±ã¼ã·ã§ã³ããã®ãã¼ã¿åå¾ã楽ã«ã§ãã¾ãããããã ãã«ãã¼ã¿ãã¼ã¹ã¨ã®ããã¨ããæ¹åããæé©åããªãã¡ã¯ã¿ãªã³ã°ã®éè¦æ§ãããããã«ã
Ruby æ¨æºæ·»ä»ã©ã¤ãã©ãªã® CSV 㧠Windows-31J (Shift_JIS ã§ãè¯ããã©) 㪠CSV ãä½ã£ã¦ããã®ã ããã©ããç¹å®ã®æåãå«ã¾ãã¦ãã㨠Encoding::UndefinedConversionError ã«ãªã£ã¦ãã¾ãã irb(main):011:0> CSV.open(File.join('/var/tmp/hoge.csv'), 'w', encoding: 'Windows-31J') do |csv| irb(main):012:1* csv << %w( d é f ) irb(main):013:1> end Encoding::UndefinedConversionError: U+00E9 from UTF-8 to Windows-31J irb(main):014:0> CSV.open(File.join('/var/tmp/h
#å¤æãã¼ãã«ä¸ã®æåãç½®æããã¦ãããã¨ãç¢ºèª from_chr = "\u{301C 2212 00A2 00A3 00AC 2013 2014 2016 203E 00A0 00F8 203A}" p from_chr p from_chr.sjisable #Shift_JISã«ãWindows-31Jã«ããªãæåã¯è«¦ãã¦ï¼ã«ãã p "ä".sjisable # Windowsæ¡å¼µé åã¯ä¿æããã¦ãããã¨ãç¢ºèª p "â â¡â¢é«å³¶å±".sjisable å®è¡çµæ ããã©ããªãããã¨ãããã®ï¼ Rubyã®å é¨ã³ã¼ãã¯ãã¯ãUTF8ãã ãã©ãæçµçã«ã¯ã¨ã¯ã»ã«åãã«ã·ããJISã®CSVãåºåãããã¨ããããã ãã©ãå é¨ã³ã¼ãããåºåæã«ã¨ã³ã³ã¼ãå¤æãããã¨ã対å¿ããæåãè¦ã¤ãããªãã¦ãä¾å¤ãã§ã¡ãããä¾å¤ã¯ã¤ãªã®ã§ãå¤å°ã¯æåãç½®ãæãï¼ãããã¯å ¨ãå¤æã§ããªããã®ã¯ï¼ã«ç½®æï¼ãã¦
rails webã¢ããªã±ã¼ã·ã§ã³ã®ä½ææã«ããä¸è¦§ãã¼ã¿ãExcelã§éããããã¨ããè¦æããã伺ãã¾ãã ããã§æ¬è¨äºã§ã¯railsã¢ããªã«ãã¼ã¿ã®ä¸è¦§ãcsvå½¢å¼ã§ãã¦ã³ãã¼ãåºæ¥ãæ©è½ã追å ããæ¹æ³ã«ã¤ãã¦è§£èª¬ãã¾ãã ã¾ãã¯ã¢ãã«ã«CSVå½¢å¼ã®ãã¼ã¿ãè¿å´ããã¡ã½ãããå®ç¾©ãã¾ãã ä»åã¯ä¾ã¨ãã¦åå(Item)ã¢ãã«ãæ±ããååã¢ãã«ã¯åååã¨ä¾¡æ ¼ã®ã«ã©ã ãæã¤ã¨ãããã¨ã«ãã¾ãã CSVãã¡ã¤ã«ãæ±ãã«ã¯ãæ¨æºã®CSVããã±ã¼ã¸ã使ãã®ãç°¡åã§ãã ãã¡ã¤ã«ãµã¤ãºã巨大ï¼ä¾ãã° 100Mãã¤ã以ä¸ï¼ã§ç¡ããã°æ§è½çã«ãåé¡ãªãã§ãããã require 'csv' class Item < ActiveRecord::Base def self.to_csv headers = %w(ID ååå ä¾¡æ ¼ ä½ææ¥æ æ´æ°æ¥æ) csv_data = CSV.generate(h
ã¯ããã« RSpec 3ãæ£å¼ãªãªã¼ã¹ããã¦2ã¶æã»ã©çµéãã¾ããã(æ£å¼ãªãªã¼ã¹ã¯2014å¹´6æ) ãããã®æ å ±ãè¦ã¦ããã¨ãããã¾ã§ã¯ãæ¢åã®ãã¹ãã±ã¼ã¹ãRSpec 3ã«ã¢ããã°ã¬ã¼ããããæ¹æ³ãããRSpec 3ã§åé¤ãããããè¨æ³ãå¤ãã£ããããç¹ããªã©ããå®ãã®å§¿å¢ãã«å ¥ã£ãæ å ±ãå¤ãã£ãããã«æãã¾ãã(åèªèº«ãããããæ å ±ãããããã¢ãããã¦ãã¾ãã) ããããRSpec 3ã§ã¯ä»¥åã®ãã¼ã¸ã§ã³ã§ã¯ä½¿ããªãã£ãæ°ããæ©è½ãæ°å¤ãå°å ¥ããã¦ãã¾ãã ããã§æ¬è¨äºã§ã¯ãæ»ãã®å§¿å¢ãã§ãRSpec 3ããå°å ¥ãããæ°æ©è½ããã¾ã¨ãã¦ã¿ã¾ããã ãªããããã§ãã©ã¼ã«ã¹ããã®ã¯ãã¹ãã³ã¼ãã®æ¸ãæ¹ã«ãã¤ã¬ã¯ãã«é¢ãã£ã¦ãããããã£ã®æ°æ©è½ã§ãã 2015.01.12ï¼RSpec 3.1ã«é¢ããæ å ±ã追è¨ãã¾ãã RSpec 3.1ã«é¢ããæ å ±ã追è¨ãã¾ããã ãã¨ãã¨ç´¹ä»ãã¦ããæ°æ©
Myron Marston » New in RSpec 3: Composable Matchersã®è¨³ã§ãã ãããã¨ãããã£ããTwitterã§@nilp_ã¾ã§ãé¡ããã¾ã RSpec 3ã®ãæã大ããªæ°æ©è½ã3.0.0.beta2ã§å ¬éããã¾ãã: ã³ã³ãã¼ã¶ãã«ãããã£(çµã¿åããå¯è½ãªãããã£ã¼)ã§ãã ããã«ããå¼·åã§å£ãã¥ããæ¤è¨¼ãæ¸ããããã«ãªããæ°ããªå¯è½æ§ãéãã¾ããã ä¾ RSpec 2.xã§ã¯ãç§ã¯ãã®ãããªã³ã¼ãã度ã æ¸ãã¦ãã¾ããã class BackgroundWorker attr_reader :queue def initialize @queue = [] end def enqueue(job_data) queue << job_data.merge(:enqueued_at => Time.now) end end describe Back
ã©ããä½ãªã®ããã¾ã«æ··ä¹±ããã®ã§ã¡ã¢ï¼ == ãªãã¸ã§ã¯ãã®åå¤æ§ã®ãã§ã㯠ã¯ã©ã¹ããªãã¸ã§ã¯ãã®æ§è³ªã«åããã¦åå®ç¾©ã§ãã === ãªãã¸ã§ã¯ãã®åå¤æ§ã®ãã§ãã¯(æå±æ§ãå å³) caseå¼ã§ä½¿ããã ã¯ã©ã¹ããªãã¸ã§ã¯ãã®æ§è³ªã«åããã¦åå®ç¾©ã§ãã eql? ãªãã¸ã§ã¯ãã®åå¤æ§ã®ãã§ãã¯(==ããå³å¯) Hashã§äºã¤ã®ãã¼ãçãããã©ãããå¤å®ããã®ã«ä½¿ããã ã¯ã©ã¹ããªãã¸ã§ã¯ãã®æ§è³ªã«åããã¦åå®ç¾©ã§ãã åå®ç¾©ããå ´åã¯hashã¡ã½ãããåå®ç¾©ããªããã°ãªããªã equal? ãªãã¸ã§ã¯ãã®åä¸æ§ã®ãã§ã㯠object_idãä¸è´ãããã©ããã調ã¹ã åå®ç¾©ãã¦ã¯ãªããªã æ¯è¼è¡¨ å¹æ使ç¨å ´é¢åå®ç¾© ==åå¤æ§ã®ãã§ãã¯åå¤æ§ã®ãã§ãã¯â ===åå¤æ§ã®ãã§ãã¯(æå±æ§)caseå¼â eql?åå¤æ§ã®ãã§ãã¯(å³å¯)Hashãã¼ã®æ¯è¼â(â») equal?åä¸æ§ã®ãã§ãã¯
Test::Unitã«ãããflunkã¨åããããªãã®ã it ã®ãããã¯å ã«å ã«æ¸ãã¨ãã®ãã¹ãã±ã¼ã¹ï¼Exampleï¼ã¯å¿ ã失æããã it "æ¨æ¥å¸å£ã®ä¸ã§æãã¤ããä»æ§" do violated end ãã£ãã¨ãã¹ãæ¸ããã¨ãããã¬ãã·ã£ã¼ãæ¼ãã ãã¹ãèªä½ãå®ã³ã¼ãã®å®è£ ã®ä¿çç¶æ ã示ãã it ã®ãããã¯å ã«pendingã¨æ¸ãã¨ããã®è¡ä»¥éã®å¦çã¯å®è¡ãããªãã pendingã¡ã½ããã使ãã¨ãã«ã¯å¼æ°ã«å¿ ãçç±ãæ¸ããªãã¦ã¯ãªããªãã it "ä¸æ¨æ¥é¢¨åã®ä¸ã§æãã¤ããä»æ§" do pending("ãããã¨ãªãçç±") # æ¤è¨¼ãããªãã¨ã¯ã¹ãã¯ãã¼ã·ã§ã³ end ã¾ãpendingã«ã¯ãããã¯ãä¸ãããã¨ãã§ãããã®å ´åã¯ãã®ãããã¯å ã®å¦çã ãããã³ãã£ã³ã°æ±ãã«ãªãã it "ããªãã ãã¤ã¯ã«ä¹ã£ã¦ã¦æãã¤ããä»æ§" do pending("大人ã®äºæ ") do
ãã§ã«ååã®ããããRSpec(shared example groupç·¨) - ã·ãããã¾ããã§ç»å ´ãã¦ããã©ããããã¦letã調ã¹ãããrspec-core(2.5.1)/features/helper_methods/let.featureãåèã«ã let è¦ããã«ã¡ã¢åããããã§ãåä¸ãµã³ãã«å ã ã¨åããªãã¸ã§ã¯ãã使ãã¾ãããã®ã ãªãéããµã³ãã«ã§ã¯æ¹ãã¦è©ä¾¡ããããããã«é 延è©ä¾¡ãªã®ã§å®éã«è©ä¾¡ãããã®ã¯æåã«ã¡ã½ãããå¼ã°ããã¨ãã ã $count = 0 describe 'let' do let(:count) { $count += 1 } it 'memoizes the value' do count.should == 1 count.should == 1 end it 'is not cached across examples' do count.shou
ããã³ã¾ãã¯ãRuby ã«é¢ããæè¡è¨äºã¯ãã¡ããã®ãã¨ãRubyist ã¸ã®ã¤ã³ã¿ãã¥ã¼ãã¨ãã»ã¤ããã®ä»ããå±ãããã¦ã§ãéèªã§ãã Rubyist Magazine ã«ã¤ã㦠ãRubyist Magazineããç¥ãã¦ããã³ã¾ãã¯ãRubyist ã® Rubyist ã«ãããRubyist ã¨ããã§ãªã人ã®ããã®ã¦ã§ãéèªã§ãã ææ°å· Rubyist Magazine 0064 å· ããã¯ãã³ãã¼ Rubyist Magazine 0064 å· Rubyist Magazine 0063 å· Rubyist Magazine 0062 å· Kaigi on Rails ç¹éå· RubyKaigi Takeout 2020 ç¹éå· Rubyist Magazine 0061 å· Rubyist Magazine 0060 å· RubyKaigi 2019 ç´åç¹éå· Rubyist
A Rails plugin is either an extension or a modification of the core framework. Plugins provide: A way for developers to share bleeding-edge ideas without hurting the stable code base. A segmented architecture so that units of code can be fixed or updated on their own release schedule. An outlet for the core developers so that they don't have to include every cool new feature under the sun. After r
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}