るりまサーチ

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

別のキーワード

  1. psych to_yaml
  2. yaml/dbm select
  3. yaml/store new
  4. yaml yaml

ライブラリ

検索結果

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

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

...関連付けるタグの文字列

=== Example
require 'psych'

class 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.ya...
...ml_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:0x0000...