るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. << rexml::attribute#name
  2. add rexml::attribute#name
  3. handle_interrupt thread#raise
  4. oid= openssl::x509::extension#oid
  5. oid openssl::x509::extension#oid=

ライブラリ

検索結果

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

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

...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 class
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>...