$30 off During Our Annual Pro Sale. View Details »
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
970
How to Enjoy the Murajun’s Style
murajun1978
0
75
Building Tebukuro with Hotwire and Rails
murajun1978
0
1.5k
Zeitwerk integration in Rails 6.0
murajun1978
0
120
Efficient development with GraphQL
murajun1978
0
320
Effective Debugging Apps in VS Code
murajun1978
1
940
tebukuro
murajun1978
0
130
Shinosaka.rb #17 Hands on
murajun1978
0
62
New Features in Rails 4.2
murajun1978
0
940
Other Decks in Programming
See All in Programming
ゆくKotlin くるRust
exoego
1
160
Grafana:建立系統全知視角的捷徑
blueswen
0
190
tparseでgo testの出力を見やすくする
utgwkk
2
280
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
890
エディターってAIで操作できるんだぜ
kis9a
0
760
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
420
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
960
AIエージェントの設計で注意するべきポイント6選
har1101
5
2.3k
Cell-Based Architecture
larchanjo
0
140
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
160
Developing static sites with Ruby
okuramasafumi
0
320
GoLab2025 Recap
kuro_kurorrr
0
780
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.1k
The Pragmatic Product Professional
lauravandoore
37
7.1k
Unsuck your backbone
ammeep
671
58k
Abbi's Birthday
coloredviolet
0
3.7k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
190
Six Lessons from altMBA
skipperchong
29
4.1k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
88
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
310
ラッコキーワード サービス紹介資料
rakko
0
1.8M
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
280
Designing for Performance
lara
610
69k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
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 :)