るりまサーチ

最速Rubyリファレンスマニュアル検索!
253件ヒット [1-100件を表示] (0.108秒)
トップページ > クエリ:i[x] > クエリ:end[x] > モジュール:Kernel[x] > クエリ:require[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. ipaddr to_i
  5. csv to_i

検索結果

<< 1 2 3 > >>

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'
i
f 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`

i
f $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'
i
f 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"
......

絞り込み条件を変える

<< 1 2 3 > >>