別のキーワード
ライブラリ
- ビルトイン (118)
- bigdecimal (12)
- drb (12)
-
irb
/ cmd / load (12) - optparse (12)
- rake (12)
- rubygems (12)
-
rubygems
/ version (12)
クラス
- BigDecimal (12)
- Class (12)
-
DRb
:: DRbUnknown (12) -
Gem
:: Version (12) -
IRB
:: ExtendCommand :: Load (12) - Module (24)
- Object (48)
- OptionParser (12)
-
Rake
:: Application (12) - Random (24)
-
RubyVM
:: InstructionSequence (10)
モジュール
- Kernel (12)
検索結果
先頭5件
-
RubyVM
:: InstructionSequence # to _ binary(extra _ data = nil) -> String (35265.0) -
バイナリフォーマットでシリアライズされたiseqのデータを文字列として返します。 RubyVM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。
...て返します。
RubyVM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。
引数の extra_data はバイナリデータと共に保存されます。
RubyVM::InstructionSequence.load_from_binary_extra_data メソッ......ry で得たバイナリデータは他のマシンに移動できません。他のバージョンや他のアーキテクチャのRubyで作られたバイナリデータは使用できません。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.to_binary("extr......合上改行しているが実際は改行はない
# => "YARB\x02\x00\x00\x00\x03\x00\x00\x00\x16\x02\x00\x00\n\x00\x00\x00\x01
# \x00\x00\x00\x03\x00\x00\x00\x05\x00\x00\x00\x84\x01\x00\x00\x88\x01\x00
# \x00\x02\x02\x00\x00x86_64-darwin15\x00*\x00\x00\x00\x00\x00\x00\x00\x01
# \x00\x00\x00\x00\x0... -
OptionParser
# load(filename = nil) -> bool (21226.0) -
指定された filename を読み込んで各行をまとめたものに対して OptionParser#parse を行ないます。
...を読み込んで各行をまとめたものに対して OptionParser#parse を行ないます。
パースが成功した場合に true を返します。
ファイルが存在しなかった場合に false を返します。
@param filename 各行をパースしたいファイルの名前を文......。
//emlist[例][ruby]{
require "optparse"
IO.write("options.txt", %w(-a --b).join("\n"))
options = { a: false, b: false }
OptionParser.new do |opt|
opt.on('-a') { |v| options[:a] = v }
opt.on('--b') {|v| options[:b] = v }
opt.load("options.txt") # => true
opt.load("not_exist.txt") # =>......false
end
p options # => {:a=>true, :b=>true}
//}... -
DRb
:: DRbUnknown # reload -> object (15333.0) -
保持しているマーシャリングされたオブジェクトをRubyのオブジェクトに 変換しようと試みます。
...をRubyのオブジェクトに
変換しようと試みます。
DRbUnknown オブジェクトを受け取った後に対応するクラスが定義された場合、
このメソッドでそのクラスのオブジェクトに変換できます。
変換を試みて失敗した場合は DRbUnknow... -
Gem
:: Version # marshal _ load(array) -> nil (15320.0) -
ダンプされた情報をロードし、自身を破壊的に変更します。
...ダンプされた情報をロードし、自身を破壊的に変更します。
//emlist[][ruby]{
version = Gem::Version.new('')
version.marshal_load(["1.2.0a"])
p version # => #<Gem::Version "1.2.0a">
//}
@param array バージョン情報を含む配列を指定します。... -
Random
# marshal _ load(array) -> Random (12374.0) -
Random#marshal_dump で得られた配列を基に、Randomオブジェクトを復元します。
...
Random#marshal_dump で得られた配列を基に、Randomオブジェクトを復元します。
@param array 三要素以下からなる配列を指定します。
何を指定するかはRandom#marshal_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... -
Object
# marshal _ load(obj) -> object (12372.0) -
Marshal.#load を制御するメソッドです。
...arshal.#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 を使......うべきです。
@param obj marshal_dump の返り値のコピーです。
@return 返り値は無視されます。
@see Object#marshal_dump, Marshal... -
Module
# autoload(const _ name , feature) -> nil (6337.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
...に参照した時に feature を Kernel.#require するように設定します。
const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義さ......せん。
@param const_name String または Symbol で指定します。
なお、const_name には、"::" 演算子を含めることはできません。
つまり、self の直下に定義された定数しか指定できません。
@param feature Kernel.#require と同様な方......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... -
Class
# _ load(str) -> Class (6314.0) -
Object#_dump を参照して下さい。
...Object#_dump を参照して下さい。
@param str Ruby のオブジェクトがダンプされた文字列を指定します。... -
Module
# autoload?(const _ name) -> String | nil (6313.0) -
autoload 定数がまだ定義されてない(ロードされていない) ときにそのパス名を返します。 また、ロード済みなら nil を返します。
...autoload 定数がまだ定義されてない(ロードされていない) ときにそのパス名を返します。
また、ロード済みなら nil を返します。
@param const_name String または Symbol で指定します。
@see Kernel.#autoload?
//emlist[例][ruby]{
autoload :Date, '......date'
autoload?(:Date) # => "date"
Date
autoload?(:Date) # => nil
autoload?(:Foo) # => nil
//}...