14件ヒット
[1-14件を表示]
(0.043秒)
別のキーワード
キーワード
-
$ -I (1) -
$ : (1) -
$ ARGV (1) -
$ CHILD _ STATUS (1) -
$ DEFAULT _ INPUT (1) -
$ INPUT _ LINE _ NUMBER (1) -
$ LAST _ MATCH _ INFO (1) -
$ LAST _ PAREN _ MATCH (1) -
$ LOAD _ PATH (1) -
$ NR (1) -
$ ORS (1) -
$ OUTPUT _ RECORD _ SEPARATOR (1) -
require
_ relative (1)
検索結果
先頭5件
-
Kernel
. # require(feature) -> bool (54517.0) -
Ruby ライブラリ feature をロードします。拡張子補完を行い、 同じファイルの複数回ロードはしません。
...(/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
$ $ -I -> [String] (18805.0) -
Rubyライブラリをロードするときの検索パスです。
...Rubyライブラリをロードするときの検索パスです。
Kernel.#load や Kernel.#require
がファイルをロードする時に検索するディレクトリのリストを含む配列です。
起動時にはコマンドラインオプション -I で指定したディレクトリ、... -
Kernel
$ $ : -> [String] (18805.0) -
Rubyライブラリをロードするときの検索パスです。
...Rubyライブラリをロードするときの検索パスです。
Kernel.#load や Kernel.#require
がファイルをロードする時に検索するディレクトリのリストを含む配列です。
起動時にはコマンドラインオプション -I で指定したディレクトリ、... -
Kernel
$ $ LOAD _ PATH -> [String] (18805.0) -
Rubyライブラリをロードするときの検索パスです。
...Rubyライブラリをロードするときの検索パスです。
Kernel.#load や Kernel.#require
がファイルをロードする時に検索するディレクトリのリストを含む配列です。
起動時にはコマンドラインオプション -I で指定したディレクトリ、... -
Kernel
. # require _ relative(relative _ feature) -> bool (18499.0) -
現在のファイルからの相対パスで require します。
...じです。
Kernel.#eval などで文字列を評価した場合に、そこから
require_relative を呼出すと必ず失敗します。
@param relative_feature ファイル名の文字列です。
@raise LoadError ロードに失敗した場合に発生します。
@see Kernel.#require
=== r......ラリのローカル変数を
ロード元のスクリプトから直接取得することはできません。
このスコープの扱い方はKernel.#loadでも同様です。
//emlist[例][ruby]{
# ---------- some.rb -----------
$a = 1
@a = 1
A = 1
a = 1
# ---------- end some.rb -------
requi... -
Kernel
$ $ LAST _ MATCH _ INFO -> MatchData | nil (18433.0) -
$~ の別名
$~ の別名
require "English"
str = "<a href=https://www.ruby-lang.org/en/about/license.txt>license</a>"
if /<a href=(.+?)>/ =~ str
p $LAST_MATCH_INFO[0] #=> "<a href=https://www.ruby-lang.org/en/about/license.txt>"
p $LAST_MATCH_INFO[1] #=> "https://www.ruby-lang.org/en/about/license.t... -
Kernel
$ $ INPUT _ LINE _ NUMBER -> Integer (18364.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
$ $ NR -> Integer (18364.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
$ $ ORS -> String | nil (18364.0) -
$\ の別名
$\ の別名
require "English"
print "hoge\nhuga\n"
$OUTPUT_RECORD_SEPARATOR = "\n"
print "fuge"
print "ugo"
# end of sample.rb
ruby sample.rb
hoge
huga
fuge
ugo -
Kernel
$ $ OUTPUT _ RECORD _ SEPARATOR -> String | nil (18364.0) -
$\ の別名
$\ の別名
require "English"
print "hoge\nhuga\n"
$OUTPUT_RECORD_SEPARATOR = "\n"
print "fuge"
print "ugo"
# end of sample.rb
ruby sample.rb
hoge
huga
fuge
ugo -
Kernel
$ $ ARGV -> [String] (18361.0) -
$* の別名
$* の別名
require "English"
p $ARGV
# end of sample.rb
ruby sample.rb 31 /home/hoge/fuga.txt
#=> ["31", "/home/hoge/fuga.txt"] -
Kernel
$ $ CHILD _ STATUS -> Process :: Status | nil (18361.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
$ $ DEFAULT _ INPUT -> IO (18361.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"
... -
Kernel
$ $ LAST _ PAREN _ MATCH -> String | nil (18361.0) -
$+ の別名
$+ の別名
require "English"
r1 = Regexp.compile("<img src=(http:.+?)>")
r2 = Regexp.compile("<a href=(http|ftp).+?>(.+?)</a>")
while line = DATA.gets
[ r1, r2 ].each {|rep|
rep =~ line
p $+
}
end
__END__
<tr> <td><img src=http://localhost/a.jpg></td> <td>ikkou</td>...