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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
96
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
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
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
240
Getting more out of Maven
mlvandijk
0
110
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
570
ファインチューニングせずメインコンペを解く方法
pokutuna
0
300
CDK Deployのための ”反響定位”
watany
4
710
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
4.8k
アーキテクチャモダナイゼーションとは何か
nwiizo
17
4.9k
Coding as Prompting Since 2025
ragingwind
0
820
PHPで TLSのプロトコルを実装してみるをもう一度しゃべりたい
higaki_program
0
190
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
710
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
270
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
3
270
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
180
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
210
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
First, design no harm
axbom
PRO
2
1.2k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
420
How STYLIGHT went responsive
nonsquared
100
6k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
330
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Facilitating Awesome Meetings
lara
57
6.8k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Become a Pro
speakerdeck
PRO
31
5.9k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
170
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 :)