Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rubyとblock
Search
murajun1978
February 19, 2014
Programming
0
62
Rubyとblock
murajun1978
February 19, 2014
Tweet
Share
More Decks by murajun1978
See All by murajun1978
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
1.1k
How to Enjoy the Murajun’s Style
murajun1978
0
92
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.5k
Zeitwerk integration in Rails 6.0
murajun1978
0
130
Efficient development with GraphQL
murajun1978
0
320
Effective Debugging Apps in VS Code
murajun1978
1
960
tebukuro
murajun1978
0
130
Shinosaka.rb #17 Hands on
murajun1978
0
66
New Features in Rails 4.2
murajun1978
0
950
Other Decks in Programming
See All in Programming
株式会社 Sun terras カンパニーデック
sunterras
0
2.1k
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
540
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
290
Docコメントで始める簡単ガードレール
keisukeikeda
1
110
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
120
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
230
Claude Code Skill入門
mayahoney
0
290
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
540
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
240
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
560
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1k
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
430
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
The Cult of Friendly URLs
andyhume
79
6.8k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.4k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
61
52k
Marketing to machines
jonoalderson
1
5k
GraphQLとの向き合い方2022年版
quramy
50
14k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
170
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
860
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
200
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
390
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
670
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 :)