用法
shift → [name, value] or nil
从
中删除第一个环境变量并返回一个包含其名称和值的 2 元素 ENV
:Array
ENV.replace('foo' => '0', 'bar' => '1')
ENV.to_hash # => {'bar' => '1', 'foo' => '0'}
ENV.shift # => ['bar', '1']
ENV.to_hash # => {'foo' => '0'}
究竟哪个环境变量是“first” 是OS-dependent。见About Ordering。
如果环境为空,则返回 nil
。
相关用法
- Ruby ENV.select!用法及代码示例
- Ruby ENV.select用法及代码示例
- Ruby ENV.slice用法及代码示例
- Ruby ENV.empty?用法及代码示例
- Ruby ENV.to_a用法及代码示例
- Ruby ENV.clear用法及代码示例
- Ruby ENV.each_value用法及代码示例
- Ruby ENV.delete_if用法及代码示例
- Ruby ENV.values_at用法及代码示例
- Ruby ENV.except用法及代码示例
- Ruby ENV.delete用法及代码示例
- Ruby ENV.to_s用法及代码示例
- Ruby ENV.reject用法及代码示例
- Ruby ENV.freeze用法及代码示例
- Ruby ENV.value?用法及代码示例
- Ruby ENV.each_key用法及代码示例
- Ruby ENV.reject!用法及代码示例
- Ruby ENV.key用法及代码示例
- Ruby ENV.include?用法及代码示例
- Ruby ENV.rassoc用法及代码示例
- Ruby ENV.fetch用法及代码示例
- Ruby ENV.replace用法及代码示例
- Ruby ENV.invert用法及代码示例
- Ruby ENV.keys用法及代码示例
- Ruby ENV.each用法及代码示例
注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 ENV.shift。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。