るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.015秒)
トップページ > クラス:Object[x] > クエリ:initialize[x] > 種類:特異メソッド[x]

別のキーワード

  1. win32ole ole_activex_initialize
  2. ri initialize
  3. object initialize
  4. darkfish initialize
  5. _builtin initialize

ライブラリ

検索結果

Object.yaml_tag(tag) -> () (8.0)

クラスと tag の間を関連付けます。

...s Foo
def initialize(x)
@x = x
end

attr_reader :x
end

# Dumps Ruby object normally
p Psych.dump(Foo.new(3))
# =>
# --- !ruby/object:Foo
# x: 3

# Registers tag with class Foo
Foo.yaml_as("tag:example.com,2013:foo")
# ... and dumps the object of Foo clas...
...s
Psych.dump(Foo.new(3), STDOUT)
# =>
# --- !<tag:example.com,2013:foo>
# x: 3

# Loads the object from the tagged YAML node
p Psych.load(<<EOS)
--- !<tag:example.com,2012:foo>
x: 8
EOS
# => #<Foo:0x0000000130f48 @x=8>...