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
62
0
Share
Rubyとblock
murajun1978
February 19, 2014
More Decks by murajun1978
See All by murajun1978
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
1.1k
How to Enjoy the Murajun’s Style
murajun1978
0
95
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
330
Effective Debugging Apps in VS Code
murajun1978
1
960
tebukuro
murajun1978
0
140
Shinosaka.rb #17 Hands on
murajun1978
0
68
New Features in Rails 4.2
murajun1978
0
960
Other Decks in Programming
See All in Programming
AIエージェントで業務改善してみた
taku271
0
390
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
780
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
160
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
200
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
200
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
290
Feature Toggle は捨てやすく使おう
gennei
0
410
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
370
Nuxt Server Components
wattanx
0
240
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
4
2.8k
Kubernetes上でAgentを動かすための最新動向と押さえるべき概念まとめ
sotamaki0421
2
380
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
4.5k
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Claude Code のすすめ
schroneko
67
220k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
210
Become a Pro
speakerdeck
PRO
31
5.9k
The browser strikes back
jonoalderson
0
890
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
510
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
54k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Designing for Timeless Needs
cassininazir
0
180
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
390
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 :)