別のキーワード
ライブラリ
- csv (36)
- nkf (12)
-
rexml
/ document (48) -
ripper
/ filter (12) - shell (24)
-
shell
/ command-processor (24) -
shell
/ filter (108) - uri (24)
クラス
- CSV (36)
-
REXML
:: Text (48) - Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (108) -
URI
:: LDAP (24)
キーワード
- < (6)
- > (6)
- >> (6)
-
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) - NKF (12)
- [] (6)
- build (24)
- cat (18)
- each (6)
- echo (18)
- filter (36)
- foreach (6)
- glob (18)
- mkdir (6)
- new (12)
- out (6)
-
ruby 1
. 6 feature (12) - system (6)
- tee (18)
- test (6)
-
test
/ unit (1) -
to
_ a (6) -
to
_ s (18) - tracer (12)
- transact (6)
- unnormalize (12)
- value (12)
- | (6)
検索結果
先頭5件
-
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"...