1065件ヒット
[1-100件を表示]
(0.062秒)
別のキーワード
ライブラリ
クラス
- Array (129)
- CSV (24)
-
CSV
:: Table (24) - Date (12)
-
Digest
:: Base (60) - Enumerator (72)
-
Enumerator
:: Yielder (12) - FrozenError (6)
- Integer (30)
- Method (31)
- Module (12)
-
Net
:: HTTP (60) -
Net
:: HTTPResponse (24) - Object (72)
-
OpenSSL
:: BN (12) - OptionParser (36)
- Proc (7)
-
Psych
:: Visitors :: YAMLTree (24) -
Rake
:: Application (12) -
Rake
:: MakefileLoader (12) - Regexp (24)
- Set (96)
- String (214)
- StringIO (24)
モジュール
- Enumerable (24)
-
REXML
:: StreamListener (12)
キーワード
- [] (18)
- add (12)
- add? (12)
-
add
_ loader (12) -
append
_ as _ bytes (1) - clone (24)
- concat (21)
- digest (12)
- digest! (12)
- divide (24)
- dup (24)
- each (72)
- empty? (12)
- entitydecl (12)
- extend (12)
- get (24)
- gsub (48)
- gsub! (48)
- hexdigest (12)
- hexdigest! (12)
-
initialize
_ copy (12) - inspect (12)
- load (12)
- match (24)
- methods (12)
- pack (21)
- permutation (24)
- pos= (12)
- post (24)
-
prepend
_ features (12) -
prev
_ year (12) - product (24)
- push (24)
- puts (12)
-
read
_ body (24) - receiver (6)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - separator (12)
-
set
_ debug _ output (12) -
singleton
_ methods (12) -
sort
_ by (24) - string (12)
- sub (36)
- sub! (36)
- summarize (24)
-
to
_ s (24) - unpack (12)
-
with
_ index (24)
検索結果
先頭5件
-
Proc
# <<(callable) -> Proc (21243.0) -
self と引数を合成した Proc を返します。
...合成した Proc を返します。
戻り値の Proc は可変長の引数を受け取ります。
戻り値の Proc を呼び出すと、まず受け取った引数を callable に渡して呼び出し、
その戻り値を self に渡して呼び出した結果を返します。
Proc#>> とは......@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
f = proc { |x| x * x }
g = proc { |x| x + x }
# (3 + 3) * (3 + 3)
p (f << g).call(3) # => 36
//}
//emlist[call を定義したオブジェクトを渡す例][ruby]{
clas......anner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = proc { |data| puts "word count: #{data.size}" } << WordScanner << File.method(:read)
pipeline.call('testfile') # => word count: 4
//}
@see Method#<<, Method#>>... -
OpenSSL
:: BN # <<(other) -> OpenSSL :: BN (21213.0) -
自身を other ビット左シフトした値を返します。
...自身を other ビット左シフトした値を返します。
//emlist[][ruby]{
bn = 1.to_bn
pp bn << 1 # => #<OpenSSL::BN 2>
pp bn # => #<OpenSSL::BN 1>
//}
@param other シフトするビット数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#lshift!... -
Psych
:: Visitors :: YAMLTree # <<(object) (21123.0) -
変換対象の Ruby オブジェクトを追加します。
...変換対象の Ruby オブジェクトを追加します。
@param object YAML AST へ変換する Ruby オブジェクト... -
Method
# <<(callable) -> Proc (18249.0) -
self と引数を合成した Proc を返します。
...self と引数を合成した Proc を返します。
戻り値の Proc は可変長の引数を受け取ります。
戻り値の Proc を呼び出すと、まず受け取った引数を callable に渡して呼び出し、
その戻り値を self に渡して呼び出した結果を返します......び出しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
def f(x)
x * x
end
def g(x)
x + x
end
# (3 + 3) * (3 + 3)
p (method(:f) << method(:g)).call(3) # => 36
//}
//emlist[call......][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = method(:pp) << WordScanner << File.method(:read)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>... -
Array
# <<(obj) -> self (18149.0) -
指定された obj を自身の末尾に破壊的に追加します。
...ます。
//emlist[例][ruby]{
ary = [1]
ary << 2
p ary # [1, 2]
//}
またこのメソッドは self を返すので、以下のように連続して
書くことができます。
//emlist[例][ruby]{
ary = [1]
ary << 2 << 3 << 4
p ary #=> [1, 2, 3, 4]
//}
@param obj 自身に加えた......いオブジェクトを指定します。Array#push と違って引数は一つしか指定できません。
@see Array#push... -
Enumerator
:: Yielder # <<(object) -> () (18143.0) -
Enumerator.new で使うメソッドです。
...が実行され、
ブロック内の << が呼ばれるたびに each に渡されたブロックが
<< に渡された値とともに繰り返されます。
//emlist[例][ruby]{
enum = Enumerator.new do |y|
y << 1
y << 2
y << 3
end
enum.each do |v|
p v
end
# => 1
# 2
# 3
//}......クが実行され、
ブロック内の << が呼ばれるたびに each に渡されたブロックが
<< に渡された値とともに繰り返されます。
//emlist[例][ruby]{
enum = Enumerator.new do |y|
y << 1
y << 2
y << 3
end
enum.each do |v|
p v
end
# => 1
# 2
# 3
//}... -
String
# <<(other) -> self (18141.0) -
self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。
...加します。
self を返します。
@param other 文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "stringXXX"
str << "YYY"
p str # => "stringXXXYYY"
str << 65 # 文字AのASCIIコード
p str # => "stringXXXYYYA"
//}......追加します。
self を返します。
@param other 文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "stringXXX"
str << "YYY"
p str # => "stringXXXYYY"
str << 65 # 文字AのASCIIコード
p str # => "stringXXXYYYA"
//}... -
Set
# <<(o) -> self (18131.0) -
集合にオブジェクト o を加えます。
...します。<< は add の別名です。
add? は、集合に要素が追加された場合には self を、変化がなかった場合には
nil を返します。
@param o 追加対象のオブジェクトを指定します。
//emlist[][ruby]{
require 'set'
s = Set[1, 2]
s << 10
p s......# => #<Set: {1, 2, 10}>
p s.add?(20) # => #<Set: {1, 2, 10, 20}>
p s.add?(2) # => nil
//}......を返します。<< は add の別名です。
add? は、集合に要素が追加された場合には self を、変化がなかった場合には
nil を返します。
@param o 追加対象のオブジェクトを指定します。
//emlist[][ruby]{
s = Set[1, 2]
s << 10
p s # =>......#<Set: {1, 2, 10}>
p s.add?(20) # => #<Set: {1, 2, 10, 20}>
p s.add?(2) # => nil
//}... -
Integer
# <<(bits) -> Integer (18125.0) -
シフト演算子。bits だけビットを左にシフトします。
...シフト演算子。bits だけビットを左にシフトします。
@param bits シフトさせるビット数
//emlist[][ruby]{
printf("%#b\n", 0b0101 << 1) # => 0b1010
p -1 << 1 # => -2
//}... -
Array
# repeated _ permutation(n) -> Enumerator (12220.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......mlist[例][ruby]{
a = [1, 2]
a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation......0).to_a #=> [[]] # one permutation of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result...