261件ヒット
[1-100件を表示]
(0.047秒)
クラス
-
ARGF
. class (24) - Binding (7)
- MatchData (4)
- Module (180)
- Object (12)
- Refinement (4)
- String (24)
- Symbol (6)
キーワード
- === (24)
-
alias
_ method (12) - captures (2)
- deconstruct (2)
-
delete
_ prefix (8) -
delete
_ prefix! (8) -
deprecate
_ constant (12) -
import
_ methods (4) -
inplace
_ mode (12) - private (48)
- protected (48)
- public (48)
- putc (12)
-
source
_ location (7) -
start
_ with? (14)
検索結果
先頭5件
-
String
# delete _ prefix(prefix) -> String (15322.0) -
文字列の先頭から prefix を削除した文字列のコピーを返します。
...ら prefix を削除した文字列のコピーを返します。
@param prefix 先頭から削除する文字列を指定します。
@return 文字列の先頭から prefix を削除した文字列のコピー
//emlist[][ruby]{
"hello".delete_prefix("hel") # => "lo"
"hello".delete_prefix("llo")......# => "hello"
//}
@see String#delete_prefix!
@see String#delete_suffix
@see String#start_with?... -
String
# delete _ prefix!(prefix) -> self | nil (15221.0) -
self の先頭から破壊的に prefix を削除します。
...prefix を削除します。
@param prefix 先頭から削除する文字列を指定します。
@return 削除した場合は self、変化しなかった場合は nil
//emlist[][ruby]{
"hello".delete_prefix!("hel") # => "lo"
"hello".delete_prefix!("llo") # => nil
//}
@see String#delete_prefi......x
@see String#delete_suffix!
@see String#start_with?... -
String
# start _ with?(*prefixes) -> bool (9151.0) -
self の先頭が prefixes のいずれかであるとき true を返します。
...の先頭が prefixes のいずれかであるとき true を返します。
@param prefixes パターンを表す文字列または正規表現 (のリスト)
//emlist[例][ruby]{
"string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_with?(......"ing", "str") # => true
"string".start_with?(/\w/) # => true
"string".start_with?(/\d/) # => false
//}
@see String#end_with?
@see String#delete_prefix, String#delete_prefix!... -
Refinement
# import _ methods(*modules) -> self (3015.0) -
モジュールからメソッドをインポートします。
...ールからメソッドをインポートします。
Module#includeと違って、import_methods はメソッドをコピーして
refinement に追加して、refinementでインポートしたメソッドを有効化します。
メソッドをコピーするため、Rubyコードで定義さ......[][ruby]{
module StrUtils
def indent(level)
' ' * level + self
end
end
module M
refine String do
import_methods StrUtils
end
end
using M
p "foo".indent(3) # => " foo"
module M
refine String do
import_methods Enumerable
# Can't import method which is not defined with Ru... -
ARGF
. class # inplace _ mode -> String | nil (126.0) -
c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。
c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡
張子を返します。拡張子が設定されていない場合は空文字列を返します。イン
プレースモードでない場合は nil を返します。
Ruby 起動時の -i オプション や ARGF.class#inplace_mode= で設定します。
例:
# $ echo "test" > test.txt
# $ ruby -i.bak test.rb test.txt
# $ cat test.txt # => "TEST"
# $ cat test.txt.bak # => "test"
# test... -
Module
# private(name) -> String | Symbol (122.0) -
メソッドを private に設定します。
...ます。
可視性については d:spec/def#limit を参照して下さい。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定し... -
Module
# protected(name) -> String | Symbol (122.0) -
メソッドを protected に設定します。
...ます。
可視性については d:spec/def#limit を参照して下さい。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定し... -
Module
# public(name) -> String | Symbol (122.0) -
メソッドを public に設定します。
...ます。
可視性については d:spec/def#limit を参照して下さい。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定し... -
MatchData
# captures -> [String] (111.0) -
$1, $2, ... を格納した配列を返します。
$1, $2, ... を格納した配列を返します。
MatchData#to_a と異なり $& を要素に含みません。
グループにマッチした部分文字列がなければ対応する要素は nil になります。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
p $~.captures # => ["foo", "bar", nil]
//}
@see MatchData#to_a, MatchData#named_captures, d... -
MatchData
# deconstruct -> [String] (111.0) -
$1, $2, ... を格納した配列を返します。
$1, $2, ... を格納した配列を返します。
MatchData#to_a と異なり $& を要素に含みません。
グループにマッチした部分文字列がなければ対応する要素は nil になります。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
p $~.captures # => ["foo", "bar", nil]
//}
@see MatchData#to_a, MatchData#named_captures, d... -
Binding
# source _ location -> [String , Integer] (110.0) -
self の Ruby のソースファイル名と行番号を返します。
self の Ruby のソースファイル名と行番号を返します。
d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。
//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//} -
Symbol
# start _ with?(*prefixes) -> bool (109.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
//}... -
Object
# ===(other) -> bool (37.0) -
case 式で使用されるメソッドです。d:spec/control#case も参照してください。
...se 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") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <...