るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.021秒)
トップページ > クラス:Object[x] > クエリ:class[x] > クエリ:===[x] > バージョン:2.6.0[x]

別のキーワード

  1. argf.class lines
  2. argf.class each
  3. argf.class each_line
  4. class new
  5. argf.class gets

検索結果

Object#===(other) -> bool (54358.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

...ドは case 式での振る舞いを考慮して、
各クラスの性質に合わせて再定義すべきです。

デフォルトでは内部で Object#== を呼び出します。

when 節の式をレシーバーとして === を呼び出すことに注意してください。

また Enumerable...
...String class. But don't hit."
else
"unknown"
end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <Ruby's world>
//}

@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep...

Object.yaml_tag(tag) -> () (76.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>...