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
63
0
Share
Rubyとblock
murajun1978
February 19, 2014
More Decks by murajun1978
See All by murajun1978
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
1.2k
How to Enjoy the Murajun’s Style
murajun1978
0
97
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
970
tebukuro
murajun1978
0
140
Shinosaka.rb #17 Hands on
murajun1978
0
70
New Features in Rails 4.2
murajun1978
0
960
Other Decks in Programming
See All in Programming
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
270
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
440
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
720
AIと共に生きる技術選定 2026
sgash708
0
120
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
230
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
170
AIを導入する前にやるべきこと
negima
2
320
WebAssembly を読み込むベストプラクティス 2026年春版 / Best Practices for Loading WebAssembly (Spring 2026)
petamoriken
5
1k
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.1k
AWSコミュニティ活動は顧客のクラウド推進に効くのか / Do AWS community activities help customers adopt the cloud?
seike460
PRO
0
160
CDK Deployのための ”反響定位”
watany
5
920
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
440
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
AI: The stuff that nobody shows you
jnunemaker
PRO
6
620
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Context Engineering - Making Every Token Count
addyosmani
9
860
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
200
Building Adaptive Systems
keathley
44
3k
Claude Code のすすめ
schroneko
67
220k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
sira's awesome portfolio website redesign presentation
elsirapls
0
230
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
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 :)