Ruby is fun but difficult

Ruby is fun but difficult

2017/02/10の社内勉強会用に作成した資料です。

クイズのページはこちら。
https://hoshinotsuyoshi.com/ruby_truthy_or_falsy/

クイズのソースはこちら。
https://github.com/hoshinotsuyoshi/ruby_truthy_or_falsy

B122e77de860c4307034f0a041dabc8e?s=128

hoshino tsuyoshi

February 10, 2017
Tweet

Transcript

  1. !IPTIJOPUTVZPTIJGFFEGPSDF*OD 'FCSVBSZ  3VCZJTGVOCVUEJ⒏DVMU

  2. .F !IPTIJOPUTVZPTIJ IUUQIPQQJFIBUFOBCMPHDPN

  3. .ZDBSFFS w ձࣾ" w MPHJTUJDT w ձࣾ# w NBSLFUJOH w

    ϑΟʔυϑΥʔε w FOHJOFFS
  4. *T3VCZGVO

  5. .FUIPE$IBJO

  6. File.read('hoge.csv') .split("\n") .sort .uniq .map(&:to_i) .select{|n| (1..100).cover?(n) }

  7. 4JOBUSB

  8. get(‘/’) { ‘hello!’ }

  9. #MBDL.BHJD

  10. 8JOEPXT

  11. None
  12. None
  13. .ZDBSFFS w ձࣾ" w MPHJTUJDT w ձࣾ# w NBSLFUJOH w

    ϑΟʔυϑΥʔε w FOHJOFFS
  14. 5IFQSFTFOUBUJPOJT BMNPTUEPOF

  15. )PXDBO*FYQSFTT UIJTGFFMJOH

  16. ͭ2VJ[

  17. 2VJ[XIBUJTUIF SFUVSOWBMVF

  18. 2i.class

  19. irb(main):001:0> 2i.class => Complex

  20. ( 2i * 2i ) < -3

  21. irb(main):002:0> ( 2i * 2i ) < -3 NoMethodError: undefined

    method `<' for (-4+0i):Complex from (irb):2 from /Users/hoshino/.rbenv/ versions/2.4.0/bin/irb:11:in `<main>'
  22. None
  23. None
  24. None
  25. None
  26. 1SJ[F

  27. 0OMZDPSSFDU BOTXFST

  28. *OTQJSFECZ

  29. *,&"PS%FBUI

  30. None
  31. None
  32. *TJU1PLFNPOPS#JH %BUB

  33. None
  34. None
  35. 5PEBZT3VMF

  36. USVUIZPSGBMTZPS FSSPS

  37. 8IBUJTUSVUIZ

  38. None
  39. 0I +BWB4DSJQU

  40. None
  41. %POUXPSSZ

  42. *UT3VCZ w falseJTGBMTZ w nilJTGBMTZ w "MMPUIFSPCKFDUTBSFUSVUIZ 5IBUTTPTJNQMFZFBI

  43. &OWJSPONFOU w 5FTUFEJOT.BD w NBD044JFSSB w 1PXFSFECZSCFOW w $ ruby

    -v w ruby 2.4.0p0 (2016-12-24 revision57164) [x86_64-darwin16]
  44. /PX WJTJU w IUUQTIPTIJOPUTVZPTIJDPNSVCZ@USVUIZ@PS@GBMTZ

  45. $PODMVTJPO w 3VCZJTEJ⒏DVMU w #VUSVCZJTGVO w +BWB4DSJQUJTEJ⒏DVMU