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
65
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.3k
How to Enjoy the Murajun’s Style
murajun1978
0
100
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.5k
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
140
Shinosaka.rb #17 Hands on
murajun1978
0
72
New Features in Rails 4.2
murajun1978
0
960
Other Decks in Programming
See All in Programming
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.6k
Oxcを導入して開発体験が向上した話
yug1224
4
310
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
130
Lessons from Spec-Driven Development
simas
PRO
0
190
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
130
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
7
4.4k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
220
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
240
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
230
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
260
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
170
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
A Tale of Four Properties
chriscoyier
163
24k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
480
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
360
How GitHub (no longer) Works
holman
316
150k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Raft: Consensus for Rubyists
vanstee
141
7.5k
Into the Great Unknown - MozCon
thekraken
41
2.6k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
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 :)