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
60
Rubyとblock
murajun1978
February 19, 2014
Tweet
Share
More Decks by murajun1978
See All by murajun1978
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
720
How to Enjoy the Murajun’s Style
murajun1978
0
61
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.3k
Zeitwerk integration in Rails 6.0
murajun1978
0
110
Efficient development with GraphQL
murajun1978
0
310
Effective Debugging Apps in VS Code
murajun1978
1
910
tebukuro
murajun1978
0
120
Shinosaka.rb #17 Hands on
murajun1978
0
54
New Features in Rails 4.2
murajun1978
0
920
Other Decks in Programming
See All in Programming
SwiftでMCPサーバーを作ろう!
giginet
PRO
2
240
Introduction to Git & GitHub
latte72
0
110
バイブコーディング × 設計思考
nogu66
0
120
Understanding Ruby Grammar Through Conflicts
yui_knk
1
100
オホーツクでコミュニティを立ち上げた理由―地方出身プログラマの挑戦 / TechRAMEN 2025 Conference
lemonade_37
2
460
DynamoDBは怖くない!〜テーブル設計の勘所とテスト戦略〜
hyamazaki
1
200
202507_ADKで始めるエージェント開発の基本 〜デモを通じて紹介〜(奥田りさ)The Basics of Agent Development with ADK — A Demo-Focused Introduction
risatube
PRO
6
1.4k
実践!App Intents対応
yuukiw00w
1
250
可変性を制する設計: 構造と振る舞いから考える概念モデリングとその実装
a_suenami
10
1.7k
Google I/O Extended Incheon 2025 ~ What's new in Android development tools
pluu
1
270
画像コンペでのベースラインモデルの育て方
tattaka
3
1.6k
decksh - a little language for decks
ajstarks
4
21k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.8k
Being A Developer After 40
akosma
90
590k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
For a Future-Friendly Web
brad_frost
179
9.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
How to Think Like a Performance Engineer
csswizardry
25
1.8k
Automating Front-end Workflow
addyosmani
1370
200k
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 :)