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 Require
Search
Gene Wu
December 20, 2014
Technology
490
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby Require
by 吕小荣
Gene Wu
December 20, 2014
More Decks by Gene Wu
See All by Gene Wu
API Documentation with Swagger UI
genewoo
0
710
新手学习Web开发经验分享
genewoo
2
690
Other Decks in Technology
See All in Technology
LLM機能を自作して分かるSnowflake Cortex AIの強み
nayuts
0
370
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
860
二歩目のフロントエンド・ウェブアクセシビリティ
camiha
2
390
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
340
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
320
「事実」を「計測」して、「解釈」する 〜AWS Lambdaのメモリ最適解の見つけ方〜
maimyyym
0
140
今こそ知りたいAmplifyGen2
mkdev10
2
160
継続的なAIコスト最適化
bgpat
1
290
USB PDを使ってスマホを労わりたい
raspython3
0
160
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.2k
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
7
2.6k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
A designer walks into a library…
pauljervisheath
211
25k
Rails Girls Zürich Keynote
gr2m
96
14k
Are puppies a ranking factor?
jonoalderson
2
4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
400
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
How to train your dragon (web standard)
notwaldorf
96
6.9k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
How GitHub (no longer) Works
holman
316
150k
Transcript
Ruby require 吕⼩小荣
医⽣生 产品狗 程序员 @xiaoronglv
2.1.5 > require 'json' => true 2.1.5 > JSON.parse "{\"a\":1}"
=> {"a"=>1}
⽅方法?关键字?
where?
咖啡机
> require 'coffee_machine'
$LOAD_PATH
拼接 /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb >
require 'coffee_machine'
失败
添加 $LOAD_PATH
/coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb /coffee_machine.rb >
require 'coffee_machine' => true
$LOADED_FEATURES
$LOADED_FEATURES > puts $LOADED_FEATURES ... ..... /…/…coffee_machine.rb • 全局变量 •
数组 • 已经require过的⽂文件 • 绝对地址(?) • 第⼆二次 require 时,直接 false
None
⼆二
None
require 'active_support'
/active_support.rb /active_support.rb /active_support.rb /active_support.rb /active_support.rb /active_support.rb /active_support.rb /active_support.rb require 'active_support'
=> it should raise LoadError, right?
require 'active_support' => true
RubyGems RubyGems was created in about November 2003 and is
now part of the standard library from Ruby version 1.9.
覆盖 require • load from the existing Ruby load path
• activate gem
activate gem
1.9.3 > spec = Gem::Specification.find_by_path('active_support') => #<Gem::Specification:0x80442624 activesupport-4.1.4> 1.9.3-p547 :005
> spec.activate => true active gem
Vs
None
Bundler 如何 require 它的 gems? 三
Gemfile
Gemfile
$LOAD_PATH
$LOAD_PATH > require 'bundler/setup' => true
$LOAD_PATH
将 Gemfile.lock 中的 所有gem 添加到 $LOAD_PATH中
Bundler.require(:default, development)
四 Rails 如何使⽤用 bundler require 它的 gems?
config.ru
enviroment.rb
application.rb
boot.rb
Learning • 与⼤大⽜牛 Pair • 参与多元项⺫⽬目
Thanks