515件ヒット
[1-100件を表示]
(0.067秒)
別のキーワード
ライブラリ
- ビルトイン (329)
- date (24)
- ipaddr (12)
-
irb
/ cmd / help (12) -
net
/ imap (12) - openssl (12)
-
rexml
/ document (24) -
rexml
/ streamlistener (12) - shell (24)
-
shell
/ command-processor (24) -
shell
/ filter (30)
クラス
-
ARGF
. class (12) - Bignum (3)
- Date (24)
-
Enumerator
:: Lazy (93) - Fixnum (3)
- IPAddr (12)
-
IRB
:: ExtendCommand :: Help (12) - Integer (36)
- Method (7)
- Module (12)
-
Net
:: IMAP :: FetchData (12) - Object (12)
-
OpenSSL
:: BN (12) - Proc (7)
-
Process
:: Status (12) -
REXML
:: Element (24) -
RubyVM
:: InstructionSequence (48) - Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (30) - String (84)
モジュール
キーワード
- [] (24)
-
absolute
_ path (12) - attr (12)
-
base
_ label (12) - cat (18)
- chunk (24)
-
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) - echo (18)
- entitydecl (12)
- execute (12)
- glob (18)
- gsub (48)
- label (12)
-
next
_ year (12) - path (12)
- prepend (12)
-
singleton
_ class (12) -
slice
_ after (22) -
slice
_ before (36) -
slice
_ when (11) - sub (36)
- tee (18)
-
to
_ io (12)
検索結果
先頭5件
-
Date
# >>(n) -> Date (18156.0) -
self から n ヶ月後の日付オブジェクトを返します。 n は数値でなければなりません。
...Date.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...>
Date.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...>
//}
対応する月に同じ日が存在しない時は、代わりにその月の末日が使われます。
//emlist[][ruby]{
require 'date'
Date.new(2001,1,28) >> 1 #=> #<Date: 20......(2001,1,31) >> 1 #=> #<Date: 2001-02-28 ...>
//}
このことは以下のように、もしかすると予期しない振る舞いをするかもしれません。
//emlist[][ruby]{
require 'date'
Date.new(2001,1,31) >> 2 #=> #<Date: 2001-03-31 ...>
Date.new(2001,1,31) >> 1 >> 1 #=> #......<Date: 2001-03-28 ...>
Date.new(2001,1,31) >> 1 >> -1 #=> #<Date: 2001-01-28 ...>
//}
Date#next_month も参照してください。
@param n 月数... -
Process
:: Status # >>(num) -> Integer (18123.0) -
self.to_i >> num と同じです。
...self.to_i >> num と同じです。
@param num 整数を指定します。
fork { exit 99 } #=> 26563
Process.wait #=> 26563
$?.to_i #=> 25344
$? >> 8 #=> 99... -
Method
# >>(callable) -> Proc (18119.0) -
self と引数を合成した Proc を返します。
...d(:f) >> method(:g)).call(3) # => 18
//}
//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = File.method(:read) >> WordScanner >> met......hod(:pp)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>>... -
Proc
# >>(callable) -> Proc (18119.0) -
self と引数を合成した Proc を返します。
...(f >> g).call(3) # => 18
//}
//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = proc { |fname| File.read(fname) } >> WordScanner >>......method(:p)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Method#<<, Method#>>... -
Bignum
# >>(bits) -> Fixnum | Bignum (18113.0) -
シフト演算子。bits だけビットを右にシフトします。
...フトします。
右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
printf("%#b\n", 0b0101 >> 1) #=> 0b10
p -1 >> 1 #=> -1... -
Fixnum
# >>(bits) -> Fixnum | Bignum (18113.0) -
シフト演算子。bits だけビットを右にシフトします。
...フトします。
右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
printf("%#b\n", 0b0101 >> 1) #=> 0b10
p -1 >> 1 #=> -1... -
Integer
# >>(bits) -> Integer (18113.0) -
シフト演算子。bits だけビットを右にシフトします。
...、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
//emlist[][ruby]{
printf("%#b\n", 0b0101 >> 1) # => 0b10
p -1 >> 1 # => -1
//}... -
Shell
:: Filter # >>(to) -> self (18113.0) -
toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。
...IOオブジェクトならばそれに出力します。
使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open("tail.out", "w") # でも同じ。
}... -
OpenSSL
:: BN # >>(other) -> OpenSSL :: BN (18107.0) -
自身を other ビット右シフトした値を返します。
...自身を other ビット右シフトした値を返します。
//emlist[][ruby]{
require 'openssl'
bn = 2.to_bn
bn >> 1 # => #<OpenSSL::BN 1>
bn # => #<OpenSSL::BN 2>
//}
@param other シフトするビット数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#rshift!... -
IPAddr
# >>(num) -> IPAddr (18101.0) -
ビットごとの右シフト演算により、新しい IPAddr オブジェクトを生成します。
ビットごとの右シフト演算により、新しい IPAddr オブジェクトを生成します。
@param num 右シフトする桁数。 -
Module
# prepend(*modules) -> self (49.0) -
指定したモジュールを self の継承チェインの先頭に「追加する」ことで self の定数、メソッド、モジュール変数を「上書き」します。
...def foo
puts "A" #(1a)
end
end
A.new.foo
# (1x) (2x)(ここの super で A#foo を呼びだす) (1a) (3x) の順に実行される
# >> X1
# >> A
# >> X2
# 2つのモジュールを X, Y を prepend X, Y という順で指定したもの
module Y
def foo
puts "Y1" #(1y)
super #(2......1b)
end
end
B.new.foo
# (1x) (2x) (1y) (2y) (1b) (3y) (3x) の順に実行される
# X#foo のほうが Y#foo より継承チェインの手前側にあり、そちらが優先される
# >> X1
# >> Y1
# >> B
# >> Y2
# >> X2
# prepend Y, X とすると Y1 X1 B X2 Y2 の順で表示される
//}... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (43.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }
# >> <b id='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1', 0, 'd'){|e| p e }
# >> <d i...