るりまサーチ

最速Rubyリファレンスマニュアル検索!
35件ヒット [1-35件を表示] (0.025秒)
トップページ > クエリ:Proc[x] > クエリ:pipeline[x]

別のキーワード

  1. _builtin to_proc
  2. _builtin proc
  3. proc curry
  4. httpserver mount_proc
  5. readline completion_proc

ライブラリ

クラス

モジュール

キーワード

検索結果

Proc#<<(callable) -> Proc (21171.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 を定義した...
...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#>>...

Proc#>>(callable) -> Proc (21171.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#>>...

Open3.#pipeline(*cmds) -> [Process::Status] (18213.0)

指定したコマンドのリストをパイプで繋いで順番に実行します。

.../share/man/man1/ruby.1.gz"
p Open3.pipeline(["zcat", fname], "nroff -man", "less")
#=> [#<Process::Status: pid 11817 exit 0>,
# #<Process::Status: pid 11820 exit 0>,
# #<Process::Status: pid 11828 exit 0>]

例2:

require "open3"

Open3.pipeline([{"LANG"=>"C"}, "env"], ["grep", "LA...

Method#<<(callable) -> Proc (159.0)

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

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

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

Method#>> とは呼び出しの順序が逆になります。

@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) # =>...
...uby]{
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#>>...

Method#>>(callable) -> Proc (159.0)

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

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

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

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

@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) # =>...
...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#>>...

絞り込み条件を変える