305件ヒット
[1-100件を表示]
(0.140秒)
別のキーワード
ライブラリ
- ビルトイン (192)
- ipaddr (11)
-
irb
/ cmd / help (11) -
net
/ imap (11) - openssl (11)
-
rexml
/ document (22) -
rexml
/ streamlistener (11) - shell (6)
-
shell
/ command-processor (24) -
shell
/ filter (6)
クラス
- Bignum (3)
-
Enumerator
:: Lazy (21) - Fixnum (3)
- IPAddr (11)
-
IRB
:: ExtendCommand :: Help (11) - Integer (32)
- Method (6)
- Module (11)
-
Net
:: IMAP :: FetchData (11) -
OpenSSL
:: BN (11) - Proc (6)
-
Process
:: Status (11) -
REXML
:: Element (22) -
RubyVM
:: InstructionSequence (22) - Shell (6)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (6) - String (77)
モジュール
キーワード
- [] (21)
-
absolute
_ path (11) - attr (11)
- cat (6)
-
each
_ element _ with _ attribute (11) -
each
_ element _ with _ text (11) - echo (6)
- entitydecl (11)
- execute (11)
- glob (18)
- gsub (44)
- path (11)
- prepend (11)
-
slice
_ after (10) -
slice
_ before (11) - sub (33)
- tee (6)
検索結果
先頭5件
-
Proc
# >>(callable) -> Proc (21231.0) -
self と引数を合成した Proc を返します。
...合成した Proc を返します。
戻り値の Proc は可変長の引数を受け取ります。
戻り値の Proc を呼び出すと、まず受け取った引数を self に渡して呼び出し、
その戻り値を callable に渡して呼び出した結果を返します。
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) # => 18
//}
//emlist[call を定義し......anner
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#>>... -
OpenSSL
:: BN # >>(other) -> OpenSSL :: BN (21207.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 (21201.0) -
ビットごとの右シフト演算により、新しい IPAddr オブジェクトを生成します。
...ビットごとの右シフト演算により、新しい IPAddr オブジェクトを生成します。
@param num 右シフトする桁数。... -
Process
:: Status # >>(num) -> Integer (21123.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 (18225.0) -
self と引数を合成した Proc を返します。
...self と引数を合成した Proc を返します。
戻り値の Proc は可変長の引数を受け取ります。
戻り値の Proc を呼び出すと、まず受け取った引数を self に渡して呼び出し、
その戻り値を callable に渡して呼び出した結果を返します......び出しの順序が逆になります。
@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) # => 18
//}
//emlist[call......uby]{
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 >> method(:pp)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>>... -
Bignum
# >>(bits) -> Fixnum | Bignum (18119.0) -
シフト演算子。bits だけビットを右にシフトします。
...フトします。
右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
printf("%#b\n", 0b0101 >> 1) #=> 0b10
p -1 >> 1 #=> -1... -
Fixnum
# >>(bits) -> Fixnum | Bignum (18119.0) -
シフト演算子。bits だけビットを右にシフトします。
...フトします。
右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
printf("%#b\n", 0b0101 >> 1) #=> 0b10
p -1 >> 1 #=> -1... -
Integer
# >>(bits) -> Integer (18119.0) -
シフト演算子。bits だけビットを右にシフトします。
...、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
//emlist[][ruby]{
printf("%#b\n", 0b0101 >> 1) # => 0b10
p -1 >> 1 # => -1
//}... -
Module
# prepend(*modules) -> self (6149.0) -
指定したモジュールを self の継承チェインの先頭に「追加する」ことで self の定数、メソッド、モジュール変数を「上書き」します。
...」を処理するため、prependの引数として
渡したモジュールのインスタンスメソッドでsuperを呼ぶことで
self のモジュール/クラスのメソッドを呼び出すことができます。
実際の処理は modules の各要素の prepend_features を後ろか......だけです。
Module#prepend_features が継承チェインの改変を実行し、結果として上のような
処理が実現されます。そのため、prepend_features を override することで
prepend の処理を追加/変更できます。
@param modules prepend する Module を......Module#prepend_features, Module#prepended
//emlist[例][ruby]{
# super と prepend の組み合わせの例
module X
def foo
puts "X1" # (1x)
super # (2x)
puts "X2" # (3x)
end
end
class A
prepend X
def foo
puts "A" #(1a)
end
end
A.new.foo
# (1x) (2x)(ここの super で... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (6107.0) -
self が表す命令シーケンスの絶対パスを返します。
...compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compil......e_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"
@see RubyVM::InstructionSequence#path... -
RubyVM
:: InstructionSequence # path -> String (6107.0) -
self が表す命令シーケンスの相対パスを返します。
..."<compiled>" を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/meth......od.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"
@see RubyVM::InstructionSequence#absolute_path... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (3107.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...実行すると, それらを内容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Sh......ell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]...