るりまサーチ

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

別のキーワード

  1. psych load_stream
  2. psych safe_load
  3. irb/cmd/load execute
  4. json load
  5. psych load

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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

Ruby プログラム 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"
//}

なお、特定のデ...
...ィレクトリからファイルをロードしたい場合、
load
'filename' とするのは不適切です。必ず絶対パスを
使ってください。...

Marshal.#load(port, proc = nil) -> object (18109.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]
# ["a", 1, 10000000000, 1.0, :...

Object#marshal_load(obj) -> object (6161.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 を使う...

Random#marshal_load(array) -> Random (6109.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...

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

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

...りません。自分が変換したバイナリデータを使うべきです。

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

@see RubyVM::InstructionSequence#to_binary...

絞り込み条件を変える

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

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

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

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

@see RubyVM::InstructionSequence#to_binary...

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

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

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

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

Kernel.#autoload(const_name, feature) -> nil (6102.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...

Kernel.#autoload?(const_name) -> String | nil (6102.0)

const_name が Kernel.#autoload 設定されているか調べます。

...const_name が Kernel.#autoload 設定されているか調べます。

autoload 設定されていて、autoload 定数がまだ定義されてない(ロードされていない)
ときにそのパス名を返します。

autoload 設定されていないか、ロード済みなら nil を返し...
...lass Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----

class Foo
end
p Foo.autoload?(:Bar) #=> nil
Foo.autoload :Bar, '/tmp/foo'
p Foo.autoload?(:Bar) #=> "/tmp/foo"
p Foo::Bar #=> Foo::Bar
p Foo.autoload?(:Bar) #=> nil
//}

@see Kernel.#autoload...

Module#autoload(const_name, feature) -> nil (6102.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
//}

以下のよ...
.../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 が発生します。

//e...

絞り込み条件を変える

<< 1 2 3 ... > >>