るりまサーチ

最速Rubyリファレンスマニュアル検索!
8件ヒット [1-8件を表示] (0.034秒)
トップページ > モジュール:Kernel[x] > クエリ:file[x] > クエリ:require[x] > ライブラリ:open-uri[x]

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file atime
  4. file ctime
  5. file mtime

検索結果

Kernel.#open(name, mode = 'r', perm = nil, options = {}) -> StringIO | Tempfile | IO (115.0)

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

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

name...
...われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp:// で
始まっている文字列なら URI のリソースを取得した上で StringIO オブジェクト
または Tempfile オブジェクトを...
...Net::FTPError のサブクラスが発生します。詳しくは net/ftp
を参照して下さい。

例:

require
'open-uri'
sio = open('http://www.example.com') { |sio|
p sio.is_a?(OpenURI::Meta) # => true
p sio.content_type
puts sio.read
}

@se...
...います。

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

require
'open-uri'
open("http://www.ruby-lang.org/") {|f|
# ...
}
#=> warning: calling URI.open via Kernel#open is deprecated, call URI.o...