$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rubyとblock
Search
murajun1978
February 19, 2014
Programming
0
60
Rubyとblock
murajun1978
February 19, 2014
Tweet
Share
More Decks by murajun1978
See All by murajun1978
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
970
How to Enjoy the Murajun’s Style
murajun1978
0
75
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.5k
Zeitwerk integration in Rails 6.0
murajun1978
0
120
Efficient development with GraphQL
murajun1978
0
320
Effective Debugging Apps in VS Code
murajun1978
1
940
tebukuro
murajun1978
0
130
Shinosaka.rb #17 Hands on
murajun1978
0
62
New Features in Rails 4.2
murajun1978
0
940
Other Decks in Programming
See All in Programming
愛される翻訳の秘訣
kishikawakatsumi
3
340
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
210
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
170
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
360
これならできる!個人開発のすゝめ
tinykitten
PRO
0
130
AIエージェントの設計で注意するべきポイント6選
har1101
5
2.1k
GoLab2025 Recap
kuro_kurorrr
0
780
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
3
1.1k
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
280
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.7k
チームをチームにするEM
hitode909
0
370
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
300
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Become a Pro
speakerdeck
PRO
31
5.7k
Believing is Seeing
oripsolob
0
15
[SF Ruby Conf 2025] Rails X
palkan
0
560
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
0
31
We Have a Design System, Now What?
morganepeng
54
7.9k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.3k
The Cult of Friendly URLs
andyhume
79
6.7k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
330
Tell your own story through comics
letsgokoyo
0
760
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.8k
AI: The stuff that nobody shows you
jnunemaker
PRO
1
12
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 :)