るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel.#load(file, priv = false) -> true (18167.0)

Ruby プログラム file をロードして実行します。再ロード可能です。

...
Ruby
プログラム file をロードして実行します。再ロード可能です。

file が絶対パスのときは file からロードします。
file が相対パスのときは組み込み変数 $:
に示されるパスとカレントディレクトリを順番に探し、最初に見...
...名前空間を汚染しません。
@raise LoadError ロードに失敗した場合に発生します。
@see Kernel.#require

=== require と load の違い

Kernel.#require は同じファイルは一度だけしかロードしませんが、
Kernel.#load は無条件にロードします。
...
....so を自動的に補完しますが、
load
は行いません。
require はライブラリのロード、load
設定ファイルの読み込みなどに使うのが典型的な用途です。

//emlist[例][ruby]{
load
"#{ENV['HOME']}/.myapprc"
load
"/etc/myapprc"
//}

なお、特定のデ...

Marshal.#load(port, proc = nil) -> object (18115.0)

port からマーシャルデータを読み込んで、元のオブジェクトと同 じ状態をもつオブジェクトを生成します。

...場合には読み込んだ
オブジェクトを引数にその手続きを呼び出します。

//emlist[例][ruby]{
str = Marshal.dump(["a", 1, 10 ** 10, 1.0, :foo])
p Marshal.load(str, proc {|obj| p obj})

# => "a"
# 1
# 10000000000
# 1.0
# :foo
# ["a", 1, 10000000000, 1.0, :foo]...

RubyVM::InstructionSequence.load_from_binary(binary) -> RubyVM::InstructionSequence (9215.0)

RubyVM::InstructionSequence#to_binaryにより作られたバイナリフォーマットの文字列からiseqのオブジェクトをロードします。

...
Ruby
VM::InstructionSequence#to_binaryにより作られたバイナリフォーマットの文字列からiseqのオブジェクトをロードします。

このローダーは検証機構をもっておらず、壊れたり改変されたバイナリを読み込むと深刻な問題を引き起...
...りません。自分が変換したバイナリデータを使うべきです。

//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
binary = iseq.to_binary
Ruby
VM::InstructionSequence.load_from_binary(binary).eval # => 3
//}

@see RubyVM::InstructionSequence#to_binary...

RubyVM::InstructionSequence.load_from_binary_extra_data(binary) -> String (9115.0)

バイナリフォーマットの文字列から埋め込まれたextra_dataを取り出します。

...埋め込まれたextra_dataを取り出します。

//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
binary = iseq.to_binary("extra_data")
Ruby
VM::InstructionSequence.load_from_binary_extra_data(binary) # => extra_data
//}

@see RubyVM::InstructionSequence#to_binary...

Object#marshal_load(obj) -> object (6167.0)

Marshal.#load を制御するメソッドです。

...hal.#load を制御するメソッドです。

some のダンプ結果(Marshal.dump(some)) をロードする(Marshal.load(Marshal.dump(some)))に
は some がメソッド marshal_load を持っていなければなりません。
このとき、marshal_dump の返り値が marshal_load...
...marshal_load 時の self は、生成されたばかり(Class#allocate されたばかり) の状態です。

marshal_dump/marshal_load の仕組みは Ruby 1.8.0 から導入されました。
これから書くプログラムでは _dump/_load ではなく
marshal_dump/marshal_load を使う...

絞り込み条件を変える

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

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

...nel.#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
//}

以下のよ...
...出すこともできます。

//emlist[例][ruby]{
# ------- /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 したライブラリがネストした定数...

Random#marshal_load(array) -> Random (6115.0)

Random#marshal_dump で得られた配列を基に、Randomオブジェクトを復元します。

...arshal_dumpを参考にしてください。

@raise ArgumentError array が3より大きい場合に発生します。

//emlist[例][ruby]{
r1 = Random.new(1)
a1 = r1.marshal_dump
r2 = Random.new(3)
r3 = r2.marshal_load(a1)

p r1 == r2 # => true
p r1 == r3 # => true
//}

@see Random#marshal_dump...

Class#_load(str) -> Class (6109.0)

Object#_dump を参照して下さい。

...Object#_dump を参照して下さい。

@param str Ruby のオブジェクトがダンプされた文字列を指定します。...

Kernel.#autoload(const_name, feature) -> nil (6108.0)

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

...数を指定する方法は Module#autoload を参照してください。

const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義されてい...
...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,Ke...
<< 1 2 3 ... > >>