るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

検索結果

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

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

... Object#== を呼び出します。

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

また Enumerable#grep でも使用されます。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12...
...when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of 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 wo...
...rld>
//}

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

Object.yaml_tag(tag) -> () (113.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...
...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:0x00...