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
680
新手学习Web开发经验分享
genewoo
2
660
Other Decks in Technology
See All in Technology
AI との良い付き合い方を僕らは誰も知らない
asei
1
310
TED_modeki_共創ラボ_20251203.pdf
iotcomjpadmin
0
170
AWS re:Invent2025最新動向まとめ(NRIグループre:Cap 2025)
gamogamo
0
130
Microsoft Agent Frameworkの可観測性
tomokusaba
1
120
半年で、AIゼロ知識から AI中心開発組織の変革担当に至るまで
rfdnxbro
0
160
Next.js 16の新機能 Cache Components について
sutetotanuki
0
200
Snowflake導入から1年、LayerXのデータ活用の現在 / One Year into Snowflake: How LayerX Uses Data Today
civitaspo
0
2.6k
Cloud WAN MCP Serverから考える新しいネットワーク運用 / 20251228 Masaki Okuda
shift_evolve
PRO
0
130
MySQLとPostgreSQLのコレーション / Collation of MySQL and PostgreSQL
tmtms
1
1.4k
Snowflake Industry Days 2025 Nowcast
takumimukaiyama
0
150
Strands AgentsのEvaluatorをLangfuseにぶち込んでみた
andoooooo_bb
0
100
まだ間に合う! Agentic AI on AWSの現在地をやさしく一挙おさらい
minorun365
19
3.2k
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.5k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
770
Optimizing for Happiness
mojombo
379
70k
Faster Mobile Websites
deanohume
310
31k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.2k
Between Models and Reality
mayunak
0
150
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
180
GraphQLとの向き合い方2022年版
quramy
50
14k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
400
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
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