Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rubyとblock
Search
murajun1978
February 19, 2014
Programming
75
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rubyとblock
murajun1978
February 19, 2014
More Decks by murajun1978
See All by murajun1978
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
1.5k
How to Enjoy the Murajun’s Style
murajun1978
0
120
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.6k
Zeitwerk integration in Rails 6.0
murajun1978
0
160
Efficient development with GraphQL
murajun1978
0
350
Effective Debugging Apps in VS Code
murajun1978
1
1k
tebukuro
murajun1978
0
160
Shinosaka.rb #17 Hands on
murajun1978
0
87
New Features in Rails 4.2
murajun1978
0
990
Other Decks in Programming
See All in Programming
Railsバージョンを4倍にした話
optim
0
530
sbt 2.0: takeoff
eed3si9n
0
170
Event is what happens
moro
2
1.2k
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.7k
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
190
GraphQL の onError と Nullability のこれから
quramy
0
170
[2026-10-14](C)Re:ゼロから始める異世界生活〜始まりの終わりと終わりの始まり〜
tosite
0
140
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
110
golang-bob.pdf
iwatsukayura
0
130
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
300
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
180
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Code Review Best Practice
trishagee
74
20k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
350
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
810
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.2k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
430
Transcript
Ruby&block
block do…end {…}
yield def foo yield end foo do puts "Hello!" end
#=> Hello!
yield def foo yield if block_given? end foo do puts
"Hello!" end #=> Hello! ! foo #=>
proc def foo &proc proc.call end proc = Proc.new do
puts "Hello!" end foo &proc #=> Hello!
proc def foo name, &proc proc.call(name) end proc = Proc.new
do |name| puts “Hello, #{name}!” end foo “Ruby”, &proc #=> Hello, Ruby!
lambda def foo &lambda lambda.call end lambda = -> {puts
“Hello!”} foo &lambda #=> Hello!
proc ͱ lambda def foo block block.call 1, 2 end
foo proc { |x, y, z| p x #=> 1 p y #=> 2 p z # => nil } def foo block block.call 1, 2 end foo lambda { |x, y, z| p x p y p z } # ArgumentError
Rails model class User < ActiveRecord::Base def admin? end end
admin = [] User.all.each do |user| admin << user if user.admin? end User.select {|user| user.admin?} User.select(&:admin?)
Rails model scope class User < ActiveRecord::Base AUTHORITY_ADMIN = “admin”
scope :admin, -> { where(authority: AUTHORITY_ADMIN) } ! def admin? end end
I can have fun coding in in Ruby
Thanks :)