るりまサーチ

最速Rubyリファレンスマニュアル検索!
18件ヒット [1-18件を表示] (0.082秒)

別のキーワード

  1. fiddle ref
  2. pointer ref
  3. entity ref
  4. _builtin _id2ref
  5. rexml/document ref

ライブラリ

キーワード

検索結果

Symbol#start_with?(*prefixes) -> bool (120.0)

self の先頭が prefixes のいずれかであるとき true を返します。

...self の先頭が prefixes のいずれかであるとき true を返します。

(self.to_s.start_with?と同じです。)

@
param prefixes パターンを表す文字列または正規表現 (のリスト)

@
see Symbol#end_with?

@
see String#start_with?

//emlist[][ruby]{
:hello.start_with?("hel...
...l") #=> true
:hello.start_with?(/H/i) #=> true

# returns true if one of the prefixes matches.
:hello.start_with?("heaven", "hell") #=> true
:hello.start_with?("heaven", "paradise") #=> false
//}...

Symbol#to_proc -> Proc (14.0)

self に対応する Proc オブジェクトを返します。

.../emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡すと
# to_proc が呼ばれて Proc 化され、
# それがブロックとして渡される。
(1..3).collect(&:to_s) # => ["1", "2", "3"]
(1..3).select(&:odd?) # => [1, 3]
//}

@
see d:spec/call#block...