るりまサーチ

最速Rubyリファレンスマニュアル検索!
305件ヒット [1-100件を表示] (0.140秒)

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dh p=
  5. dh p

検索結果

<< 1 2 3 ... > >>

Proc#>>(callable) -> Proc (21231.0)

self と引数を合成した Proc を返します。

...合成した Proc を返します。

戻り値の Proc は可変長の引数を受け取ります。
戻り値の Proc を呼び出すと、まず受け取った引数を self に渡して呼び出し、
その戻り値を callable に渡して呼び出した結果を返します。

P
roc#<< とは...
...呼び出しの順序が逆になります。

@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

p
ipeline = proc { |fname| File.read(fname) } >> WordScanner >> method(:p)
p
ipeline.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
P
rocess.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

p
ipeline = File.method(:read) >> WordScanner >> method(:pp)
p
ipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

@see Proc#<<, Proc#>>...

絞り込み条件を変える

Bignum#>>(bits) -> Fixnum | Bignum (18119.0)

シフト演算子。bits だけビットを右にシフトします。

...フトします。

右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。

@param bits シフトさせるビット数

p
rintf("%#b\n", 0b0101 >> 1) #=> 0b10
p
-1 >> 1 #=> -1...

Fixnum#>>(bits) -> Fixnum | Bignum (18119.0)

シフト演算子。bits だけビットを右にシフトします。

...フトします。

右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。

@param bits シフトさせるビット数

p
rintf("%#b\n", 0b0101 >> 1) #=> 0b10
p
-1 >> 1 #=> -1...

Integer#>>(bits) -> Integer (18119.0)

シフト演算子。bits だけビットを右にシフトします。

...、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。

@param bits シフトさせるビット数

//emlist[][ruby]{
p
rintf("%#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 することで
p
repend の処理を追加/変更できます。


@param modules prepend する Module を...
...Module#prepend_features, Module#prepended

//emlist[例][ruby]{
# super と prepend の組み合わせの例
module X
def foo
p
uts "X1" # (1x)
super # (2x)
p
uts "X2" # (3x)
end
end

class A
p
repend X

def foo
p
uts "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
p
uts "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
p
uts "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.[]...
<< 1 2 3 ... > >>