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 Require
Search
Gene Wu
December 20, 2014
Technology
0
470
Ruby Require
by 吕小荣
Gene Wu
December 20, 2014
Tweet
Share
More Decks by Gene Wu
See All by Gene Wu
API Documentation with Swagger UI
genewoo
0
690
新手学习Web开发经验分享
genewoo
2
670
Other Decks in Technology
See All in Technology
なぜ今、コスト最適化(倹約)が必要なのか? ~AWSでのコスト最適化の進め方「目的編」~
htan
1
110
2026年、サーバーレスの現在地 -「制約と戦う技術」から「当たり前の実行基盤」へ- /serverless2026
slsops
2
210
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.5k
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
210
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
200
セキュリティについて学ぶ会 / 2026 01 25 Takamatsu WordPress Meetup
rocketmartue
1
290
Embedded SREの終わりを設計する 「なんとなく」から計画的な自立支援へ
sansantech
PRO
3
2.2k
システムのアラート調査をサポートするAI Agentの紹介/Introduction to an AI Agent for System Alert Investigation
taddy_919
2
1.9k
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
1.2k
MCPでつなぐElasticsearchとLLM - 深夜の障害対応を楽にしたい / Bridging Elasticsearch and LLMs with MCP
sashimimochi
0
140
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
17k
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
140
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
250
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
120
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
110
Typedesign – Prime Four
hannesfritz
42
2.9k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
Color Theory Basics | Prateek | Gurzu
gurzu
0
190
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Are puppies a ranking factor?
jonoalderson
1
2.7k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
How to Ace a Technical Interview
jacobian
281
24k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
64
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