Soumettre la recherche
Mettre en ligne
Active support事始め
•
Télécharger en tant que KEY, PDF
•
0 j'aime
•
678 vues
Jun Yokoyama
Suivre
Formation
Technologie
Signaler
Partager
Signaler
Partager
1 sur 68
Télécharger maintenant
Recommandé
An introduction to cgroups and cgroupspy
An introduction to cgroups and cgroupspy
vpetersson
2015 11-17-programming inr.key
2015 11-17-programming inr.key
Yannick Wurm
OpenStack Summit Boston DMA Appendix
OpenStack Summit Boston DMA Appendix
Tomofumi Hayashi
Weather of the Century: Design and Performance
Weather of the Century: Design and Performance
MongoDB
The Ring programming language version 1.5.3 book - Part 50 of 184
The Ring programming language version 1.5.3 book - Part 50 of 184
Mahmoud Samir Fayed
The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.3 book - Part 40 of 88
Mahmoud Samir Fayed
Debugging: A Senior's Skill
Debugging: A Senior's Skill
Milton Lenis
Know your cirrus from your cumulus
Know your cirrus from your cumulus
Andrew Phillips
Recommandé
An introduction to cgroups and cgroupspy
An introduction to cgroups and cgroupspy
vpetersson
2015 11-17-programming inr.key
2015 11-17-programming inr.key
Yannick Wurm
OpenStack Summit Boston DMA Appendix
OpenStack Summit Boston DMA Appendix
Tomofumi Hayashi
Weather of the Century: Design and Performance
Weather of the Century: Design and Performance
MongoDB
The Ring programming language version 1.5.3 book - Part 50 of 184
The Ring programming language version 1.5.3 book - Part 50 of 184
Mahmoud Samir Fayed
The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.3 book - Part 40 of 88
Mahmoud Samir Fayed
Debugging: A Senior's Skill
Debugging: A Senior's Skill
Milton Lenis
Know your cirrus from your cumulus
Know your cirrus from your cumulus
Andrew Phillips
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
jaliss
Kotlinのcoroutine、async/awaitと同じでしょ?って思ってたけど意外と洗練されててすごいなぁって思った話をさせてほしい
Kotlinのcoroutine、async/awaitと同じでしょ?って思ってたけど意外と洗練されててすごいなぁって思った話をさせてほしい
Takuya Kikuchi
The Weather of the Century Part 2: High Performance
The Weather of the Century Part 2: High Performance
MongoDB
Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !
Microsoft
масштабирование в Sql azure
масштабирование в Sql azure
Денис Резник
Divolte collector overview
Divolte collector overview
GoDataDriven
Prototyping online ML with Divolte Collector
Prototyping online ML with Divolte Collector
fvanvollenhoven
Divolte Collector - meetup presentation
Divolte Collector - meetup presentation
fvanvollenhoven
The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185
Mahmoud Samir Fayed
Rails基礎講座 part.1
Rails基礎講座 part.1
Jun Yokoyama
社内LT資料
社内LT資料
Jun Yokoyama
Rails基礎講座 part.2
Rails基礎講座 part.2
Jun Yokoyama
Ruby with Hash
Ruby with Hash
Jun Yokoyama
Ruby on
Ruby on
Jun Yokoyama
First Step TDD
First Step TDD
Jun Yokoyama
Real world rails
Real world rails
Jun Yokoyama
5 Tips for a Successful Social Media Strategy
5 Tips for a Successful Social Media Strategy
Wine Glass Marketing
RではじめるTwitter解析
RではじめるTwitter解析
Takeshi Arabiki
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
EDB
JSR 310. New Date API in Java 8
JSR 310. New Date API in Java 8
Serhii Kartashov
Tensor flow description of ML Lab. document
Tensor flow description of ML Lab. document
jeongok1
Becoming a better developer with EXPLAIN
Becoming a better developer with EXPLAIN
Louise Grandjonc
Contenu connexe
Tendances
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
jaliss
Kotlinのcoroutine、async/awaitと同じでしょ?って思ってたけど意外と洗練されててすごいなぁって思った話をさせてほしい
Kotlinのcoroutine、async/awaitと同じでしょ?って思ってたけど意外と洗練されててすごいなぁって思った話をさせてほしい
Takuya Kikuchi
The Weather of the Century Part 2: High Performance
The Weather of the Century Part 2: High Performance
MongoDB
Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !
Microsoft
масштабирование в Sql azure
масштабирование в Sql azure
Денис Резник
Divolte collector overview
Divolte collector overview
GoDataDriven
Prototyping online ML with Divolte Collector
Prototyping online ML with Divolte Collector
fvanvollenhoven
Divolte Collector - meetup presentation
Divolte Collector - meetup presentation
fvanvollenhoven
The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185
Mahmoud Samir Fayed
Tendances
(9)
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
Kotlinのcoroutine、async/awaitと同じでしょ?って思ってたけど意外と洗練されててすごいなぁって思った話をさせてほしい
Kotlinのcoroutine、async/awaitと同じでしょ?って思ってたけど意外と洗練されててすごいなぁって思った話をさせてほしい
The Weather of the Century Part 2: High Performance
The Weather of the Century Part 2: High Performance
Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !
масштабирование в Sql azure
масштабирование в Sql azure
Divolte collector overview
Divolte collector overview
Prototyping online ML with Divolte Collector
Prototyping online ML with Divolte Collector
Divolte Collector - meetup presentation
Divolte Collector - meetup presentation
The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.4 book - Part 50 of 185
En vedette
Rails基礎講座 part.1
Rails基礎講座 part.1
Jun Yokoyama
社内LT資料
社内LT資料
Jun Yokoyama
Rails基礎講座 part.2
Rails基礎講座 part.2
Jun Yokoyama
Ruby with Hash
Ruby with Hash
Jun Yokoyama
Ruby on
Ruby on
Jun Yokoyama
First Step TDD
First Step TDD
Jun Yokoyama
Real world rails
Real world rails
Jun Yokoyama
5 Tips for a Successful Social Media Strategy
5 Tips for a Successful Social Media Strategy
Wine Glass Marketing
En vedette
(8)
Rails基礎講座 part.1
Rails基礎講座 part.1
社内LT資料
社内LT資料
Rails基礎講座 part.2
Rails基礎講座 part.2
Ruby with Hash
Ruby with Hash
Ruby on
Ruby on
First Step TDD
First Step TDD
Real world rails
Real world rails
5 Tips for a Successful Social Media Strategy
5 Tips for a Successful Social Media Strategy
Similaire à Active support事始め
RではじめるTwitter解析
RではじめるTwitter解析
Takeshi Arabiki
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
EDB
JSR 310. New Date API in Java 8
JSR 310. New Date API in Java 8
Serhii Kartashov
Tensor flow description of ML Lab. document
Tensor flow description of ML Lab. document
jeongok1
Becoming a better developer with EXPLAIN
Becoming a better developer with EXPLAIN
Louise Grandjonc
Java Time Puzzlers
Java Time Puzzlers
Eric Jain
Writing Faster Python 3
Writing Faster Python 3
Sebastian Witowski
Similaire à Active support事始め
(7)
RではじめるTwitter解析
RではじめるTwitter解析
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
JSR 310. New Date API in Java 8
JSR 310. New Date API in Java 8
Tensor flow description of ML Lab. document
Tensor flow description of ML Lab. document
Becoming a better developer with EXPLAIN
Becoming a better developer with EXPLAIN
Java Time Puzzlers
Java Time Puzzlers
Writing Faster Python 3
Writing Faster Python 3
Dernier
Transaction Management in Database Management System
Transaction Management in Database Management System
Christalin Nelson
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Celine George
Expanded definition: technical and operational
Expanded definition: technical and operational
ssuser3e220a
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
Patidar M
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
BabyAnnMotar
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
Conquiztadors- the Quiz Society of Sri Venkateswara College
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Jemuel Francisco
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
Nguyen Thanh Tu Collection
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
Conquiztadors- the Quiz Society of Sri Venkateswara College
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
mary850239
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
TechSoup
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
Celine George
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
Seán Kennedy
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
Conquiztadors- the Quiz Society of Sri Venkateswara College
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
Rosabel UA
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
lancelewisportillo
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
BP KOIRALA INSTITUTE OF HELATH SCIENCS,, NEPAL
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
JojoEDelaCruz
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
Humphrey A Beña
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
Rommel Regala
Dernier
(20)
Transaction Management in Database Management System
Transaction Management in Database Management System
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Expanded definition: technical and operational
Expanded definition: technical and operational
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
Active support事始め
1.
ActiveSupport事始め 2012/8/30 yoyogi.rb
2.
自己紹介 curl http://cui-about.me/nysalor
3.
今回どうしよう
4.
今回どうしよう
5.
ActiveSupportについて
6.
ActiveSupportについて パクリ 意外と知らないメソッドが多い 復習の意味で
7.
ActiveSupport? https://github.com/rails/rails/tree/master/activesupport Railsに入っている便利ライブラリ Railsをインストールすると勝手に入る Rails抜きでも使える
8.
試してみよう
9.
試してみよう % gem install
activesupport Fetching: activesupport-3.2.8.gem (100%) Successfully installed activesupport-3.2.8 1 gem installed
10.
ついでにpryも
11.
ついでにpryも % gem install
pry % gem install pry-coolline
12.
pry? http://pryrepl.org/ irbの強化版
13.
インストール
14.
インストール % gem install
pry % gem install pry-coolline
15.
起動
16.
起動 % pry 1.9.3 (main):0
>
17.
ActiveSupportを読み込む
18.
ActiveSupportを読み込む 1.9.3 (main):0 >
require 'active_support/all' => true 1.9.3 (main):0 >
19.
String系
20.
pluralize
21.
pluralize 1.9.3 (main):0 >
'magazine'.pluralize => “magazines” 1.9.3 (main):0 > 'fantasy'.pluralize => “fantasies”
22.
singularize
23.
singularize 1.9.3 (main):0 >
'magazines'.singularize => “magazine” 1.9.3 (main):0 > 'fantasies'. singularize => “fantasy”
24.
camelize,under_score
25.
camelize,under_score 1.9.3 (main):0 >
'active_support'.camelize => “ActiveSupport” 1.9.3 (main):0 > 'ActiveSupport'.underscore => “active_support”
26.
constantize
27.
constantize 1.9.3 (main):0 >
'CurrentUser'.constantize => CurrentUser
28.
from
29.
from 1.9.3 (main):0 >
‘active_support’.from(3) => “ive_support” 1.9.3 (main):0 > ‘active_support’[3..-1] => “ive_support” # 同じ
30.
blank?
31.
blank? 1.9.3 (main):0
> nil.blank? => true 1.9.3 (main):0 > ''.blank? => true 1.9.3 (main):0 > ‘ ‘.blank? => true 1.9.3 (main):0 > ‘ ‘.blank? => true 1.9.3 (main):0 > ‘blank‘.blank? => false
32.
present?
33.
present? 1.9.3 (main):0
> true.present? => true 1.9.3 (main):0 > 'blank'.present? => true 1.9.3 (main):0 > ‘‘.present? => false 1.9.3 (main):0 > ‘ ‘.present? => false 1.9.3 (main):0 > nil.present? => false
34.
presence
35.
presence 1.9.3 (main):0
> true.presence => true 1.9.3 (main):0 > 'blank'.presence => 'blank' 1.9.3 (main):0 > ‘‘.presence => nil 1.9.3 (main):0 > ‘ ‘.presence => nil 1.9.3 (main):0 > nil.presence => nil
36.
presence
37.
presence 1.9.3 (main):0 >
‘cool’.presence || ‘oops!’ => “cool” 1.9.3 (main):0 > ["aaa", "bbb", "ccc"].map{|x| 1.9.3 (main):0 * x.gsub("a","").presence && 1.9.3 (main):0 * x.upcase} => [nil, "BBB", "CCC"]
38.
inquiry
39.
inquiry 1.9.3 (main):0 >
‘tiger’.inquiry => “tiger” 1.9.3 (main):0 > 'tiger'.inquiry.tiger? => true 1.9.3 (main):0 > 'tiger'.inquiry.bunny? => false 1.9.3 (main):0 > 'tiger'.inquiry.class => ActiveSupport::StringInquirer
40.
どうやっているのか? http://goo.gl/qt8Sz
41.
DateTime系
42.
Time.zone
43.
Time.zone 1.9.3 (main):0
> Time.zone => nil 1.9.3 (main):0 > Time.zone = ‘Tokyo’ => “Tokyo” 1.9.3 (main):0 > Time.zone => (GMT+09:00) Tokyo 1.9.3 (main):0 > Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00
44.
yesterday,tommorow
45.
yesterday,tommorow 1.9.3 (main):0
> Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > Time.zone.now.tomorrow => Fri, 31 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > Time.zone.now.yesterday => Wed, 29 Aug 2012 17:41:49 JST +09:00
46.
ago
47.
ago 1.9.3 (main):0
> Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > 3.days.ago => Mon, 27 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > 10.month.ago => Sun, 30 Oct 2011 17:41:49 JST +09:00
48.
since
49.
since 1.9.3 (main):0
> Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > 3.days.since => Sun, 02 Sep 2012 17:41:49 JST +09:00 1.9.3 (main):0 > 10.month.since => Sun, 30 Jun 2013 17:41:49 JST +09:00
50.
引数
51.
引数 1.9.3 (main):0
> Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > Time.zone.now.ago(3.days) => Mon, 27 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > Time.zone.now.since(3.years) => Sun, 30 Aug 2015 17:41:49 JST +09:00
52.
始まりと終わり
53.
始まりと終わり 1.9.3 (main):0
> Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > Time.zone.now.beginning_of_day => Thu, 30 Aug 2012 00:00:00 JST +09:00 1.9.3 (main):0 > Time.zone.now.end_of_year => Mon, 31 Dec 2012 23:59:59 JST +09:00
54.
任意の時刻
55.
任意の時刻 1.9.3 (main):0
> Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > Time.zone.now.change(:hour => 19) => Thu, 30 Aug 2012 19:00:00 JST +09:00
56.
範囲
57.
範囲 1.9.3 (main):0 >
Time.zone.now => Thu, 30 Aug 2012 17:41:49 JST +09:00 1.9.3 (main):0 > Time.zone.now.all_day => 2012-08-30 00:00:00 UTC..2012-08-30 23:59:59 UTC 1.9.3 (main):0 > Time.now.all_day => 2012-08-30 00:00:00 +0900..2012-08-30 23:59:59 +0900
58.
Array/Hash系
59.
Array#from
60.
Array#from 1.9.3 (main):0 >
‘cool’.presence || ‘oops!’ => “cool” 1.9.3 (main):0 > ["aaa", "bbb", "ccc"].map{|x| 1.9.3 (main):0 * x.gsub("a","").presence && 1.9.3 (main):0 * x.upcase} => [nil, "BBB", "CCC"]
61.
Hash#assert_valid_keys
62.
Hash#assert_valid_keys 1.9.3 (main):0 >
hash = { 1.9.3 (main):0 * :tiger => 10.4, 1.9.3 (main):0 * :lion => 10.7 1.9.3 (main):0 * } 1.9.3 (main):0 > hash.assert_valid_keys( 1.9.3 (main):0 * :tiger, :leopard, :lion) => {:tiger=>10.5, :leopard=>10.6, :lion=>10.8} 1.9.3 (main):0 > hash.assert_valid_keys( 1.9.3 (main):0 * :tiger, :bunny) => ArgumentError: Unknown key: lion
63.
Array#forty_two
64.
Array#forty_two 1.9.3 (main):0 >
[1,2,3,4].forty_two => nil 1.9.3 (main):0 > (1..100).to_a.forty_two => 42
65.
なにこれ?
66.
なにこれ?
67.
質疑応答
68.
質疑応答 if available? Question.all.map{|x|
x.try(:answer).presence || x.to_a.forty_two}
Notes de l'éditeur
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Télécharger maintenant