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
66
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.4k
How to Enjoy the Murajun’s Style
murajun1978
0
110
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.6k
Zeitwerk integration in Rails 6.0
murajun1978
0
140
Efficient development with GraphQL
murajun1978
0
330
Effective Debugging Apps in VS Code
murajun1978
1
1k
tebukuro
murajun1978
0
150
Shinosaka.rb #17 Hands on
murajun1978
0
73
New Features in Rails 4.2
murajun1978
0
970
Other Decks in Programming
See All in Programming
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.7k
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
240
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
15
2.9k
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
570
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
250
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
280
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.8k
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
8.7k
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
150
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
120
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
200
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Paper Plane
katiecoart
PRO
1
52k
New Earth Scene 8
popppiees
3
2.4k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Exploring anti-patterns in Rails
aemeredith
3
440
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
170
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 :)