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
150
Efficient development with GraphQL
murajun1978
0
340
Effective Debugging Apps in VS Code
murajun1978
1
1k
tebukuro
murajun1978
0
150
Shinosaka.rb #17 Hands on
murajun1978
0
74
New Features in Rails 4.2
murajun1978
0
970
Other Decks in Programming
See All in Programming
霧の中の代数的エフェクト
funnyycat
1
450
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
240
地域 SRE コミュニティ最前線 - ホンマでっかSRE勉強会
tk3fftk
0
290
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
200
AIエージェントで 変わるAndroid開発環境
takahirom
2
760
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.5k
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
210
Claude Team Plan導入・ガイド
tk3fftk
0
250
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
800
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
0
310
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
2
340
テーブルをDELETEした
yuzneri
0
130
Featured
See All Featured
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
240
Optimising Largest Contentful Paint
csswizardry
37
3.9k
WENDY [Excerpt]
tessaabrams
11
39k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
590
AI: The stuff that nobody shows you
jnunemaker
PRO
9
860
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
The agentic SEO stack - context over prompts
schlessera
0
860
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
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 :)