別のキーワード
種類
- インスタンスメソッド (208)
- 特異メソッド (186)
- モジュール関数 (46)
- クラス (11)
クラス
モジュール
- Enumerable (80)
- Kernel (24)
- Marshal (22)
キーワード
- < (11)
- Method (11)
- chunk (11)
- compact (3)
-
delete
_ prefix (7) -
delete
_ prefix! (7) - dump (22)
-
each
_ with _ index (22) -
import
_ methods (3) -
keep
_ if (22) -
max
_ by (44) - new (16)
- popen (154)
-
report
_ on _ exception (16) -
report
_ on _ exception= (16) -
ruby2
_ keywords (5) - select! (10)
-
start
_ with? (12) - strftime (11)
- system (24)
-
with
_ index (22)
検索結果
先頭5件
-
Data
# with(**kwargs) -> Data (18133.0) -
self をコピーしたオブジェクトを返します。
...引数に対応するメンバには引数の値が設定されます。存在しないメンバを指定した場合はエラーとなります。
@param kwargs コピーされたオブジェクトに設定されるメンバの値を指定します。
@raise ArgumentError 存在しないメンバ......", 5) # => #<data Dog name="Fred", age=5>
dog2 = dog1.with(age: 6) # => #<data Dog name="Fred", age=6>
p dog1 # => #<data Dog name="Fred", age=5>
dog3 = dog1.with(type: "Terrier") # => ArgumentError (unknown keyword: :type)
# メンバのオブジェクトはコピーされ......ず、同じオブジェクトを参照する。
dog1.name.upcase!
p dog1 # => #<data Dog name="FRED", age=5>
p dog2 # => #<data Dog name="FRED", age=6>
//}
[注意] 本メソッドの記述は Data のサブクラスのインスタンスに対して呼び
出す事を想定しています。Data.d... -
Symbol
# start _ with?(*prefixes) -> bool (6245.0) -
self の先頭が prefixes のいずれかであるとき true を返します。
...の先頭が prefixes のいずれかであるとき true を返します。
(self.to_s.start_with?と同じです。)
@param prefixes パターンを表す文字列または正規表現 (のリスト)
@see Symbol#end_with?
@see String#start_with?
//emlist[][ruby]{
:hello.start_with?("hell")......#=> 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
//}... -
String
# start _ with?(*prefixes) -> bool (6239.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!... -
String
# delete _ prefix!(prefix) -> self | nil (6208.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
# delete _ prefix(prefix) -> String (6208.0) -
文字列の先頭から prefix を削除した文字列のコピーを返します。
...から prefix を削除した文字列のコピーを返します。
@param prefix 先頭から削除する文字列を指定します。
@return 文字列の先頭から prefix を削除した文字列のコピー
//emlist[][ruby]{
"hello".delete_prefix("hel") # => "lo"
"hello".delete_prefix("ll......o") # => "hello"
//}
@see String#delete_prefix!
@see String#delete_suffix
@see String#start_with?... -
Enumerable
# each _ with _ index(*args) -> Enumerator (6146.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...繰り返すような
Enumerator を返します。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イテレータメソッド (each など) にそのま......each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}
//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}
@see Enumerator#with_index... -
Enumerable
# each _ with _ index(*args) {|item , index| . . . } -> self (6146.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...繰り返すような
Enumerator を返します。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イテレータメソッド (each など) にそのま......each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}
//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}
@see Enumerator#with_index... -
Enumerator
# with _ index(offset = 0) -> Enumerator (6140.0) -
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。
...enum = Enumerator.new {|y| str.each_byte {|b| y << b }}
enum.with_index {|byte, idx| p [byte, idx] }
# => [120, 0]
# [121, 1]
# [122, 2]
require "stringio"
StringIO.new("foo|bar|baz").each("|").with_index(1) {|s, i| p [s, i] }
# => ["foo|", 1]
# ["bar|", 2]
# [......にインデックスを添えてブロックを繰り返します。
インデックスは 0 から始まります。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。... -
Enumerator
# with _ index(offset = 0) {|(*args) , idx| . . . } -> object (6140.0) -
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。
...enum = Enumerator.new {|y| str.each_byte {|b| y << b }}
enum.with_index {|byte, idx| p [byte, idx] }
# => [120, 0]
# [121, 1]
# [122, 2]
require "stringio"
StringIO.new("foo|bar|baz").each("|").with_index(1) {|s, i| p [s, i] }
# => ["foo|", 1]
# ["bar|", 2]
# [......にインデックスを添えてブロックを繰り返します。
インデックスは 0 から始まります。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。... -
IO
. popen([env = {} , [cmdname , arg0] , *args , execopt={}] , mode = "r" , opt={}) -> IO (6134.0) -
サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。
...イプラインを確立します。生成したパイプを IO オブジェクトとして返します。
p io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p io.gets # => "foo\n"
サブプロセスを指定する方法は2通りあります。......す。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
p IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"
opt でプロセス起動のためのオプションや、パイプ IO オブジェクトの属性(......めのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照してくだ... -
IO
. popen([env = {} , [cmdname , arg0] , *args , execopt={}] , mode = "r" , opt={}) {|f| . . . } -> object (6134.0) -
サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。
...イプラインを確立します。生成したパイプを IO オブジェクトとして返します。
p io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p io.gets # => "foo\n"
サブプロセスを指定する方法は2通りあります。......す。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
p IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"
opt でプロセス起動のためのオプションや、パイプ IO オブジェクトの属性(......めのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照してくだ... -
IO
. popen([env = {} , cmdname , *args , execopt={}] , mode = "r" , opt={}) -> IO (6134.0) -
サブプロセスを実行し、そのプロセスの標準入出力 との間にパイプラインを確立します。生成したパイプを IO オブジェクトとして返します。
...イプラインを確立します。生成したパイプを IO オブジェクトとして返します。
p io = IO.popen("cat", "r+") # => #<IO:fd 4>
io.puts "foo"
io.close_write
p io.gets # => "foo\n"
サブプロセスを指定する方法は2通りあります。......す。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
p IO.popen("cat", "r+") {|io|
io.puts "foo"
io.close_write
io.gets
}
# => "foo\n"
opt でプロセス起動のためのオプションや、パイプ IO オブジェクトの属性(......めのオプションは Kernel.#spawn と、
パイプオブジェクトの属性の指定のオプションは IO.new と共通です。
つまり、 :external_encoding や :unsetenv_others が指定できます。
オプションの詳しい意味は Kernel.#spawn や IO.new を参照してくだ...