るりまサーチ

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

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

ライブラリ

キーワード

検索結果

Object#!~(other) -> bool (6201.0)

自身が other とマッチしない事を判定します。

...身が other とマッチしない事を判定します。

self#=~(obj) を反転した結果と同じ結果を返します。

@param other 判定するオブジェクトを指定します。

//emlist[例][ruby]{
obj = 'regexp'
p (obj !~ /re/) # => false

obj = nil
p (obj !~ /re/) # => true
//}...

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

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

...tag 付けされた YAML ドキュメントを Ruby のオブジェクトに
変換したりその逆をしたりすることができます。

@param tag 対象のクラスに関連付けるタグの文字列

=== Example
require 'psych'

class Foo
def initialize(x)
@x = 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>...

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

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

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

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

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

when 節の式...
...た Enumerable#grep でも使用されます。

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

//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12), ... が実行される
result =
case age
when 0 .. 2
"baby"
when 3 .. 6
"little child"
when 7 .. 12
"child"
when 1...
..."youth"
else
"adult"
end

puts result #=> "child"

def check arg
case arg
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") #=> ins...