るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 ... > >>

Ripper::Filter (18018.0)

イベントドリブンスタイルで Ruby プログラムを加工するためのクラスです。

...必要なイベントに対応するメソッドを定義して使用し
ます。

=== 使用例

//emlist[][ruby]{
require
'ripper'
require
'cgi'

class Ruby2HTML < Ripper::Filter
def on_default(event, tok, f)
f << CGI.escapeHTML(tok)
end

def on_comment(tok, f)
f << %Q[<span class="...

CSV.filter(input, options = Hash.new) {|row| ... } (6127.0)

このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。

..., output は初期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv

require
"csv"

options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end

#...
...utput を指定する][ruby]{
require
"csv"
content = <<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(File.open("test.csv"), File....

CSV.filter(input, output, options = Hash.new) {|row| ... } (6127.0)

このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。

..., output は初期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv

require
"csv"

options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end

#...
...utput を指定する][ruby]{
require
"csv"
content = <<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(File.open("test.csv"), File....

CSV.filter(options = Hash.new) {|row| ... } (6127.0)

このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。

..., output は初期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv

require
"csv"

options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
row << "row1_3"
end

#...
...utput を指定する][ruby]{
require
"csv"
content = <<EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

File.write('test.csv',content)
options = { headers: true, return_headers: true, write_headers: true }

CSV.filter(File.open("test.csv"), File....

Shell::Filter#|(filter) -> object (3141.0)

パイプ結合を filter に対して行います。

...パイプ結合を filter に対して行います。

@param filter Shell::Filter オブジェクトを指定します。

@return filter を返します。

使用例
require
'shell'
Shell.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Sh...

絞り込み条件を変える

Shell::Filter#cat(*files) -> Shell::Filter (3123.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...実行すると, それらを内容とする Filter オブジェクトを返します.

@param files シェルコマンド cat に与えるファイル名を文字列で指定します。

動作例
require
'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt...

Shell::Filter#echo(*strings) -> Shell::Filter (3123.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...実行すると, それらを内容とする Filter オブジェクトを返します.

@param strings シェルコマンド echo に与える引数を文字列で指定します。

動作例
require
'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_...

Shell::Filter#glob(pattern) -> Shell::Filter (3123.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

..., それらを内容とする Filter オブジェクトを返します.

@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。

動作例
require
'shell'
Shell.def_system_...

Shell::Filter#tee(file) -> Shell::Filter (3123.0)

実行すると, それらを内容とする Filter オブジェクトを返します.

...実行すると, それらを内容とする Filter オブジェクトを返します.

@param file シェルコマンドtee に与えるファイル名を文字列で指定します。

動作例
require
'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt"...

Shell::Filter#<(src) -> self (3006.0)

srcをフィルタの入力とする。 srcが, 文字列ならばファイルを, IOオブジェクトであれ ばそれをそのまま入力とする。

...ばそれをそのまま入力とする。

@param src フィルタの入力を, 文字列もしくは,IO オブジェクトで指定します。

使用例
require
'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
(sh.head("-n 30") < "/etc/passwd") > "ugo.txt"
}...

絞り込み条件を変える

Shell::Filter#>(to) -> self (3006.0)

toをフィルタの出力とする。 toが, 文字列ならばファイルに, IOオブジェクトであれ ばそれをそのまま出力とする。

...@param to 出力先を指定します。文字列ならばファイルに,IOオブジェクトならばそれに出力します。

使用例
require
'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") > File.open("tail.out", "w")...

Shell::Filter#>>(to) -> self (3006.0)

toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。

...@param to 出力先を指定します。文字列ならばファイルに、IOオブジェクトならばそれに出力します。

使用例
require
'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("...

Shell::Filter#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (3006.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...@param file1 文字列でファイルへのパスを指定します。

@param file2 文字列でファイルへのパスを指定します。

require
'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"...
<< 1 2 3 ... > >>