Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rubyとblock
Search
murajun1978
February 19, 2014
Programming
68
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.5k
How to Enjoy the Murajun’s Style
murajun1978
0
120
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
76
New Features in Rails 4.2
murajun1978
0
980
Other Decks in Programming
See All in Programming
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
180
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
300
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
110
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
230
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
6
3.1k
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
660
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
4
4.5k
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
480
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
120
新卒PdEのリアル
ryu1013
1
470
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Building the Perfect Custom Keyboard
takai
2
870
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
The Cost Of JavaScript in 2023
addyosmani
55
10k
The World Runs on Bad Software
bkeepers
PRO
72
12k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Visualization
eitanlees
152
17k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
450
Being A Developer After 40
akosma
91
590k
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 :)