253件ヒット
[1-100件を表示]
(0.108秒)
種類
- 変数 (143)
- インスタンスメソッド (77)
- モジュール関数 (33)
キーワード
-
$ ARGV (11) -
$ CHILD _ STATUS (11) -
$ DEFAULT _ INPUT (11) -
$ ERROR _ INFO (11) -
$ ERROR _ POSITION (11) -
$ INPUT _ LINE _ NUMBER (11) -
$ INPUT _ RECORD _ SEPARATOR (11) -
$ LAST _ MATCH _ INFO (11) -
$ LAST _ PAREN _ MATCH (11) -
$ NR (11) -
$ ORS (11) -
$ OUTPUT _ RECORD _ SEPARATOR (11) -
$ RS (11) - Digest (11)
- autoload (11)
-
enable
_ config (22) -
require
_ relative (11) -
try
_ link (22) -
with
_ config (22)
検索結果
先頭5件
-
Kernel
. # require(feature) -> bool (24232.0) -
Ruby ライブラリ feature をロードします。拡張子補完を行い、 同じファイルの複数回ロードはしません。
...字列です。
@raise LoadError ロードに失敗した場合に発生します。
//emlist[例][ruby]{
$LOADED_FEATURES.grep(/prime/).size # => 0
require "prime" # => true
$LOADED_FEATURES.grep(/prime/).size # => 1
require "prime" # => false
begin
require "invalid"
rescue LoadError......=> e
e.message # => "cannot load such file -- invalid"
end
//}
@see Kernel.#load,Kernel.#autoload,Kernel.#require_relative... -
Kernel
$ $ INPUT _ LINE _ NUMBER -> Integer (12325.0) -
$. の別名
...$. の別名
1 e
2 f
3 g
4 h
5 i
# end of a.txt
require "English"
File.foreach(ARGV.at(0)){|line|
# read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb
ruby sample.rb a.txt
#=> 5... -
Kernel
. # require _ relative(relative _ feature) -> bool (12254.0) -
現在のファイルからの相対パスで require します。
...の相対パスで require します。
require File.expand_path(relative_feature, File.dirname(__FILE__))
とほぼ同じです。
Kernel.#eval などで文字列を評価した場合に、そこから
require_relative を呼出すと必ず失敗します。
@param relative_feature ファイ......ル名の文字列です。
@raise LoadError ロードに失敗した場合に発生します。
@see Kernel.#require
=== require と load のスコープ
ローカル変数はファイル間では共有されません。ですので、
ロードしたライブラリのローカル変数を
ロー......。
このスコープの扱い方はKernel.#loadでも同様です。
//emlist[例][ruby]{
# ---------- some.rb -----------
$a = 1
@a = 1
A = 1
a = 1
# ---------- end some.rb -------
require 'some'
p $a #=> 1
p @a #=> 1
p A #=> 1
p a # undefined local variable or method `a' for #<Object:0x294f9ec... -
Kernel
# enable _ config(config , default) {|config , default| . . . } -> bool | String (6313.0) -
configure のオプションを検査します。
...configure のオプションを検査します。
configure のオプションに --enable-<config> が指定された場合は、真を返し
ます。--disable-<config> が指定された場合は。偽を返します。どちらでもな
い場合は default を返します。
これはデバ......義を、追加するのに役立ちます。
@param config configure のオプションの名前を指定します。
@param default デフォルト値を返します。
例
require 'mkmf'
if enable_config("debug")
$defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
end... -
Kernel
$ $ CHILD _ STATUS -> Process :: Status | nil (6219.0) -
$? の別名
...$? の別名
require "English"
out = `wget https://www.ruby-lang.org/en/about/license.txt -O - 2>/dev/null`
if $CHILD_STATUS.to_i == 0
print "wget success\n"
out.split(/\n/).each { |line|
printf "%s\n", line
}
else
print "wget failed\n"
end... -
Kernel
$ $ INPUT _ RECORD _ SEPARATOR -> String | nil (6219.0) -
$/ の別名
...$/ の別名
require "English"
$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end
p array #=> ["ugo|", "ego|", "fogo\n"]
__END__
ugo|ego|fogo... -
Kernel
# enable _ config(config , default) -> bool | String (6213.0) -
configure のオプションを検査します。
...configure のオプションを検査します。
configure のオプションに --enable-<config> が指定された場合は、真を返し
ます。--disable-<config> が指定された場合は。偽を返します。どちらでもな
い場合は default を返します。
これはデバ......義を、追加するのに役立ちます。
@param config configure のオプションの名前を指定します。
@param default デフォルト値を返します。
例
require 'mkmf'
if enable_config("debug")
$defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
end... -
Kernel
$ $ NR -> Integer (6125.0) -
$. の別名
...$. の別名
1 e
2 f
3 g
4 h
5 i
# end of a.txt
require "English"
File.foreach(ARGV.at(0)){|line|
# read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb
ruby sample.rb a.txt
#=> 5... -
Kernel
# Digest(name) -> object (6119.0) -
"MD5"や"SHA1"などのダイジェストを示す文字列 name を指定し、 対応するダイジェストのクラスを取得します。
...Digest::MD5などを直接呼び出すと問題があるときはこのメソッドを使
うか、起動時に使用するライブラリを Kernel.#require してください。
@param name "MD5"や"SHA1"などのダイジェストを示す文字列を指定します。
@return Digest::MD5やDig......スタンスではなく、クラスを返します。注意してください。
例: Digest::MD、Digest::SHA1、Digest::SHA512のクラス名を順番に出力する。
require 'digest'
for a in ["MD5", "SHA1", "SHA512"]
p Digest(a) # => Digest::MD5, Digest::SHA1, Digest::SHA512
end... -
Kernel
$ $ DEFAULT _ INPUT -> IO (6119.0) -
$< の別名
...$< の別名
require "English"
while line = $DEFAULT_INPUT.gets
p line
end
# end of sample.rb
ruby sample.rb < /etc/passwd
# => "hoge:x:500:501::/home/hoge:/bin/bash\n"
......