るりまサーチ

最速Rubyリファレンスマニュアル検索!
30件ヒット [1-30件を表示] (0.026秒)
トップページ > クエリ:main[x] > クエリ:autoload[x]

別のキーワード

  1. _builtin main
  2. main define_method
  3. main public
  4. main private
  5. main to_s

ライブラリ

クラス

キーワード

検索結果

Module#autoload(const_name, feature) -> nil (18161.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...ernel.#require するように設定します。

const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload
する対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしませ...
...ん。

@param feature Kernel.#require と同様な方法で autoload する対象を指定する。

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----

class Foo
autoload
:Bar, '/tmp/foo'
end
p Foo::Bar #=> Foo::Bar
//}

以下の...
...に、autoload したライブラリがネストした定数を定義しない場
合、NameError が発生します。

//emlist[例][ruby]{
# ------- /tmp/bar.rb ---------
class Bar
end
# ----- end of /tmp/bar.rb ----

class Foo
autoload
:Bar, '/tmp/bar.rb'
end
p Foo::Bar
#=> -:4:in `<main>': un...

ruby 1.6 feature (102.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...nil
nil
nil
nil

: 2002-03-14 拡張ライブラリの autoload

拡張ライブラリに対して autoload が効いていませんでした。((<ruby-dev:16379>))

autoload
:Fcntl, "fcntl"
require "fcntl"

=> -:2:in `require': uninitialized constant F...
...-09-19) [i586-linux]
1
=> ruby 1.6.5 (2001-11-01) [i586-linux]
1

: Numeric#remainder

((<ruby-bugs-ja:PR#110>))

p( 3.remainder(-3))
p(-3.remainder(3))

=> ruby 1.6.5 (2001-09-19) [i586-linux]
3
-3
=> ruby 1.6.5 (...
...Segmentation fault

=> ruby 1.6.5 (2001-10-15) [i586-linux]
MatchData
NotImplementedError
FloatDomainError
LoadError
Float
Binding
SignalException
Module
-:6:in `method_missing': stac...

NEWS for Ruby 2.7.0 (12.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...法で全ての引数を転送する時に使えます。 16154
* 変更されたメソッド
* Module#const_defined?のようにModule#autoload?が
inheritオプショナル引数を受け付けるようになりました。 15777
* Module#nameが常にfreezeされた文字...
...ar") {|v| }
opts.on("-c", "--baz", "baz") {|v| }
end.parse!
//}

//emlist{
$ ruby test.rb --baa
Traceback (most recent call last):
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
Did you mean? baz
bar
//}

* Pathname
* Pathname.globがbaseキーワ...