るりまサーチ

最速Rubyリファレンスマニュアル検索!
200件ヒット [1-100件を表示] (0.058秒)

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

種類

ライブラリ

検索結果

<< 1 2 > >>

Kernel.#open(name, mode = &#39;r&#39;, perm = nil, options = {}) -> StringIO | Tempfile | IO (6325.0)

name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

...http:// や ftp:// で始まっている文字列なら URI のリソースを
取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。
返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

name に open...
...me.open(*rest, &block) のように name の open メソッドが呼ばれます。

これ以外の場合は、name はファイル名として扱われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp://...
...::FTPError 対象となる URI のスキームが ftp であり、かつリソースの取得に失敗した時に
Net::FTPError のサブクラスが発生します。詳しくは net/ftp
を参照して下さい。

例:

require
'open-uri'
sio = open(...
...引数のオブジェクトは OpenURI::Meta モジュールで extend されています。

Ruby2.7以降、open-uriにより拡張されたKernel.openでURLを開くときにwarningが表示されるようになりました。

require
'open-uri'
open("http://www.ruby-lang.org/") {|f|
#...

Kernel$$FIELD_SEPARATOR -> String | nil (6221.0)

$; の別名

...$; の別名

require
"English"

str = "hoge,fuga,ugo,bar,foo"
p
str.split #=> ["hoge,fuga,ugo,bar,foo"]
$FIELD_SEPARATOR = ","
p
str.split #=> ["hoge", "fuga", "ugo", "bar", "foo"]...

Kernel$$INPUT_RECORD_SEPARATOR -> String | nil (6215.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$$ERROR_POSITION -> [String] | nil (6214.0)

$@ の別名

...$@ の別名

require
"English"
class SomethingError < StandardError; end

begin
raise SomethingError
rescue
p
$ERROR_POSITION #=> ["sample.rb:5"]
end...

Kernel$$LAST_PAREN_MATCH -> String | nil (6214.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>ikko...
...u</td> <td><a href=http://localhost/link.html>link</a></td> </tr>
#enf of sample.rb

$ ruby sample.rb
"http://localhost/a.jpg"
"link"...

絞り込み条件を変える

Kernel$$POSTMATCH -> String | nil (6214.0)

$' の別名

...$' の別名

require
"English"

str = 'hoge,foo,bar,hee,hoo'

/foo/ =~ str
p
$POSTMATCH #=> ",bar,hee,hoo"...

Kernel$$PREMATCH -> String | nil (6214.0)

$` の別名

...$` の別名

require
"English"

str = 'hoge,foo,bar,hee,hoo'

/foo/ =~ str
p
$PREMATCH #=> "hoge,"...

Kernel$$LOAD_PATH -> [String] (3234.0)

Rubyライブラリをロードするときの検索パスです。

...Rubyライブラリをロードするときの検索パスです。

Kernel
.#load や Kernel.#require
がファイルをロードする時に検索するディレクトリのリストを含む配列です。

起動時にはコマンドラインオプション -I で指定したディレクトリ、...
...
「i686-linux」や「alpha-osf5.1」などです。
ARCH の値は Config::CONFIG['arch'] で得られます。

コンパイル時のデフォルトパスは
多くの UNIX システムでは "/usr/local/lib/ruby" です。
p
latform/mswin32、platform/mingw32、platform/Cygwin
環境では
rub...
...y.dll の位置からの相対で決まります。

require
'foo' を実行すると、
以下のように foo.rb と foo.so が交互に探索されます。

/usr/local/lib/ruby/site_ruby/VERSION/foo.rb
/usr/local/lib/ruby/site_ruby/VERSION/foo.so
/usr/local/lib/ruby/site_ruby/VERSION/ARCH/...

Kernel$$OUTPUT_FIELD_SEPARATOR -> String | nil (3221.0)

$, の別名

...$, の別名

require
"English"

array = %w|hoge fuga ugo bar foo|
p
array.join #=> "hogefugaugobarfoo"
$OUTPUT_FIELD_SEPARATOR = ","
p
array.join #=> "hoge,fuga,ugo,bar,foo"...
<< 1 2 > >>