60件ヒット
[1-60件を表示]
(0.035秒)
種類
- 文書 (27)
- モジュール関数 (22)
- インスタンスメソッド (11)
ライブラリ
- ビルトイン (33)
クラス
- Module (11)
モジュール
- Kernel (22)
キーワード
-
NEWS for Ruby 2
. 7 . 0 (5) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11)
検索結果
先頭5件
-
Kernel
. # autoload(const _ name , feature) -> nil (27205.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
...照した時に feature を
Kernel.#require するように設定します。
const_name には、 "::" 演算子を含めることはできません。
ネストした定数を指定する方法は Module#autoload を参照してください。
const_name が autoload 設定されていて、ま......い)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしません。
@param const_name 定数をString または Symbol で指定します。
@param feature require と同様な方法で autoload する対象を......指定します。
@raise LoadError featureのロードに失敗すると発生します。
//emlist[][ruby]{
# ------- /tmp/foo.rb ---------
class Bar
end
# ----- end of /tmp/foo.rb ----
autoload :Bar, '/tmp/foo'
p Bar #=> Bar
//}
@see Kernel.#autoload?,Module#autoload,Kernel.#require... -
Kernel
. # require(feature) -> bool (27149.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... -
Module
# autoload(const _ name , feature) -> nil (18211.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
...参照した時に feature を Kernel.#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::......-- /tmp/foo.rb ---------
class Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----
class Foo
end
Foo.autoload :Bar, '/tmp/foo'
p Foo::Bar #=> Foo::Bar
//}
以下のように、autoload したライブラリがネストした定数を定義しない場
合、一見、正常に動作してい......-- /tmp/foo.rb ---------
class Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----
class Foo
end
Foo.autoload :Bar, '/tmp/foo'
p Foo::Bar #=> Foo::Bar
//}
以下のように、autoload したライブラリがネストした定数を定義しない場
合、NameError が発生します。
/... -
ruby 1
. 6 feature (102.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...nil
nil
: 2002-03-14 拡張ライブラリの autoload
拡張ライブラリに対して autoload が効いていませんでした。((<ruby-dev:16379>))
autoload :Fcntl, "fcntl"
require "fcntl"
=> -:2:in `require': uninitialized constant Fcntl (NameError)
f......数が既に定義されていると失敗していました。((<ruby-talk:30203>))
Constants = 1
require 'syslog'
p Syslog::Constants
=> -:2:in `require': Syslog::Fixnum is not a module (TypeError)
from -:2
ruby 1.6.6 (2001-12-26) [i5......def initialize(obj) @obj = obj end
def []=() @obj = obj end
def []() @obj end
end
module Kernel
def _ptr() Ptr.new(self) end
end
def foo(int)
int[] += 1
end
x = 1._ptr... -
NEWS for Ruby 2
. 7 . 0 (54.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ッドの中で、ブロックなしでProc.newやKernel#procを
呼び出すと警告が表示されるようになりました。
//emlist[][ruby]{
def foo
proc
end
foo { puts "Hello" } #=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}
* 非......以前のlazyではないEnumerator#with_indexのデフォルト実装から
lazyになりました。7877
//emlist[Enumerator.produce][ruby]{
require "date"
dates = Enumerator.produce(Date.today, &:succ) #=> infinite sequence of dates
dates.detect(&:tuesday?) #=> next Tuesday
//}
//emlist[Enume......法で全ての引数を転送する時に使えます。 16154
* 変更されたメソッド
* Module#const_defined?のようにModule#autoload?が
inheritオプショナル引数を受け付けるようになりました。 15777
* Module#nameが常にfreezeされた文字... -
ruby 1
. 8 . 4 feature (48.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...from Kernel method.
#
# * eval.c (exec_under): frame during eval should preserve external
# information.
: super [bug]
Kernelのメソッド内でsuperを呼んだ時に、存在しないsuperclass
にアクセスしようとするバグの修正。
module Kernel......nobu@ruby-lang.org>
#
# * eval.c (ev_const_get), variable.c (rb_const_get_0): retry only when
# autoload succeeded.
#
# * variable.c (rb_autoload_load): now return true if autoload
# succeeded. fixed: [ruby-dev:27331]
const_missingが再定義されていて実行......) の IP
オブジェクトがデフォルトの IP オブジェクト (デフォルトのスレッドグルー
プに属するもの.require 'multi-tk' の際に生成される) であるか,操作し
ようとしている IP オブジェクトが自らの直接の slave IP であ...