Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
940
How to Enjoy the Murajun’s Style
murajun1978
0
72
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.4k
Zeitwerk integration in Rails 6.0
murajun1978
0
120
Efficient development with GraphQL
murajun1978
0
310
Effective Debugging Apps in VS Code
murajun1978
1
940
tebukuro
murajun1978
0
130
Shinosaka.rb #17 Hands on
murajun1978
0
61
New Features in Rails 4.2
murajun1978
0
930
Other Decks in Programming
See All in Programming
AIコーディングエージェント(Manus)
kondai24
0
150
開発に寄りそう自動テストの実現
goyoki
1
680
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
220
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
960
TypeScript 5.9 で使えるようになった import defer でパフォーマンス最適化を実現する
bicstone
1
1.2k
AI時代もSEOを頑張っている話
shirahama_x
0
260
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
150
エディターってAIで操作できるんだぜ
kis9a
0
670
React Native New Architecture 移行実践報告
taminif
1
140
dnx で実行できるコマンド、作ってみました
tomohisa
0
140
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
12
7k
AIと協働し、イベントソーシングとアクターモデルで作る後悔しないアーキテクチャ Regret-Free Architecture with AI, Event Sourcing, and Actors
tomohisa
5
19k
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Designing for humans not robots
tammielis
254
26k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
GraphQLとの向き合い方2022年版
quramy
50
14k
Statistics for Hackers
jakevdp
799
230k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
710
Navigating Team Friction
lara
191
16k
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 :)