ライブラリ
- ビルトイン (18)
- date (2)
-
net
/ imap (1) -
rexml
/ document (1) - shell (2)
-
shell
/ command-processor (2) -
shell
/ filter (2)
クラス
- Date (2)
-
Enumerator
:: Lazy (8) -
Net
:: IMAP :: FetchData (1) -
Process
:: Status (1) -
REXML
:: Element (1) -
RubyVM
:: InstructionSequence (2) - Shell (2)
-
Shell
:: CommandProcessor (2) -
Shell
:: Filter (2) - String (7)
キーワード
-
absolute
_ path (1) - attr (1)
- cat (3)
- chunk (2)
-
each
_ element _ with _ attribute (1) - glob (3)
- gsub (4)
-
next
_ year (1) - path (1)
-
slice
_ after (2) -
slice
_ before (3) -
slice
_ when (1) - sub (3)
検索結果
先頭5件
-
Date
# >>(n) -> Date (63769.0) -
self から n ヶ月後の日付オブジェクトを返します。 n は数値でなければなりません。
self から n ヶ月後の日付オブジェクトを返します。
n は数値でなければなりません。
//emlist[][ruby]{
require 'date'
Date.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...>
Date.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...>
//}
対応する月に同じ日が存在しない時は、代わりにその月の末日が使われます。
//emlist[][ruby]{
require 'date'
Date.new(2001,1,28) >> 1 #=> #... -
Process
:: Status # >>(num) -> Integer (63370.0) -
self.to_i >> num と同じです。
self.to_i >> num と同じです。
@param num 整数を指定します。
fork { exit 99 } #=> 26563
Process.wait #=> 26563
$?.to_i #=> 25344
$? >> 8 #=> 99 -
Net
:: IMAP :: FetchData # attr -> { String => object } (27340.0) -
各メッセージのアトリビュートの値をハッシュテーブルで返します。
各メッセージのアトリビュートの値をハッシュテーブルで返します。
キーはアトリビュート名の文字列、値はアトリビュートの値となります。
値のクラスはアトリビュートによって異なります。
利用可能なアトリビュートは以下の通りです。
: BODY
BODYSTRUCTURE の拡張データなしの形式。
Net::IMAP::BodyTypeBasic, Net::IMAP::BodyTypeText,
Net::IMAP::BodyTypeMessage, Net::IMAP::BodyTypeMultipart
のいずれか。
: BODY[<section>]<<... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (18430.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
key で指定した属性名の属性を持つ要素のみを対象とします。
value を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。
max に 0 を指定すると、max の指定は無視されます(0個ではありません)。
@param key 属性名(文字列)
@param value 属性値(文字列)
... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (18322.0) -
self が表す命令シーケンスの絶対パスを返します。
self が表す命令シーケンスの絶対パスを返します。
self を文字列から作成していた場合は nil を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.... -
RubyVM
:: InstructionSequence # path -> String (18322.0) -
self が表す命令シーケンスの相対パスを返します。
self が表す命令シーケンスの相対パスを返します。
self の作成時に指定した文字列を返します。self を文字列から作成していた
場合は "<compiled>" を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compi... -
Shell
# cat(*files) -> Shell :: Filter (18322.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.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") >> "al... -
Shell
:: CommandProcessor # cat(*files) -> Shell :: Filter (18322.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.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") >> "al... -
Shell
:: Filter # cat(*files) -> Shell :: Filter (18322.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.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") >> "al... -
Enumerator
:: Lazy # chunk(initial _ state) {|elt , state| . . . } -> Enumerator :: Lazy (9922.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # slice _ before(initial _ state) {|elt , state| bool } -> Enumerator :: Lazy (9922.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ after(pattern) -> Enumerator :: Lazy (9622.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>
1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [... -
Enumerator
:: Lazy # slice _ before(pattern) -> Enumerator :: Lazy (9622.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Date
# next _ year(n = 1) -> Date (9322.0) -
n 年後を返します。
n 年後を返します。
self >> (n * 12) に相当します。
//emlist[例][ruby]{
require 'date'
Date.new(2001,2,3).next_year #=> #<Date: 2002-02-03 ...>
Date.new(2008,2,29).next_year #=> #<Date: 2009-02-28 ...>
Date.new(2008,2,29).next_year(4) #=> #<Date: 2012-02-29 ...>
//}
Date#>> も参照してください。
@param n 年数 -
Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy (9322.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # slice _ after {|elt| bool } -> Enumerator :: Lazy (9322.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>
1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [... -
Enumerator
:: Lazy # slice _ before {|elt| bool } -> Enumerator :: Lazy (9322.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ when {|elt _ before , elt _ after| bool } -> Enumerator :: Lazy (9322.0) -
Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007fce84118348>:each>>
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }.take(5).force
# => [[1, 2]... -
String
# gsub(pattern) -> Enumerator (613.0) -
文字列中で pattern にマッチした部分を順番にブロックに渡し、 その実行結果で置き換えた文字列を生成して返します。 ブロックなしの場合と違い、ブロックの中からは 組み込み変数 $1, $2, $3, ... を問題なく参照できます。
文字列中で pattern にマッチした部分を順番にブロックに渡し、
その実行結果で置き換えた文字列を生成して返します。
ブロックなしの場合と違い、ブロックの中からは
組み込み変数 $1, $2, $3, ... を問題なく参照できます。
@param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@return 新しい文字列
//emlist[例][ruby]{
p 'abcabc'.gsub(/[bc]/) {|s| s.upcase } #=> "aBCaBC"
... -
String
# gsub(pattern) {|matched| . . . . } -> String (613.0) -
文字列中で pattern にマッチした部分を順番にブロックに渡し、 その実行結果で置き換えた文字列を生成して返します。 ブロックなしの場合と違い、ブロックの中からは 組み込み変数 $1, $2, $3, ... を問題なく参照できます。
文字列中で pattern にマッチした部分を順番にブロックに渡し、
その実行結果で置き換えた文字列を生成して返します。
ブロックなしの場合と違い、ブロックの中からは
組み込み変数 $1, $2, $3, ... を問題なく参照できます。
@param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@return 新しい文字列
//emlist[例][ruby]{
p 'abcabc'.gsub(/[bc]/) {|s| s.upcase } #=> "aBCaBC"
... -
String
# sub(pattern) {|matched| . . . . } -> String (610.0) -
文字列中で pattern にマッチした最初の部分をブロックに渡し、 その評価結果で置き換えた新しい文字列を返します。 ブロックなしの sub と違い、ブロックの中からは 組み込み変数 $1, $2, $3, ... を問題なく参照できます。
文字列中で pattern にマッチした最初の部分をブロックに渡し、
その評価結果で置き換えた新しい文字列を返します。
ブロックなしの sub と違い、ブロックの中からは
組み込み変数 $1, $2, $3, ... を問題なく参照できます。
@param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
//emlist[例][ruby]{
p 'abcabc'.sub(/b/) {|s| s.upcase } #=> "aBcabc"
p 'abcabc'.sub(/b... -
String
# gsub(pattern , replace) -> String (358.0) -
文字列中で pattern にマッチする部分全てを 文字列 replace で置き換えた文字列を生成して返します。
文字列中で pattern にマッチする部分全てを
文字列 replace で置き換えた文字列を生成して返します。
置換文字列 replace 中の \& と \0 はマッチした部分文字列に、
\1 ... \9 は n 番目の括弧の内容に置き換えられます。
置換文字列内では \`、\'、\+ も使えます。
これらは $`、$'、$+ に対応します。
@param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した... -
String
# sub(pattern , replace) -> String (340.0) -
文字列中で pattern にマッチした最初の部分を 文字列 replace で置き換えた文字列を生成して返します。
文字列中で pattern にマッチした最初の部分を
文字列 replace で置き換えた文字列を生成して返します。
置換文字列 replace 中の \& と \0 はマッチした部分文字列に、
\1 ... \9 は n 番目の括弧の内容に置き換えられます。
置換文字列内では \`、\'、\+ も使えます。
これらは $`、$'、$+ に対応します。
@param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定し... -
Shell
# glob(pattern) -> Shell :: Filter (322.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (322.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
... -
Shell
:: Filter # glob(pattern) -> Shell :: Filter (322.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
... -
String
# gsub(pattern , hash) -> String (313.0) -
文字列中の pattern にマッチした部分をキーにして hash を引いた値で置き換えます。
文字列中の pattern にマッチした部分をキーにして hash を引いた値で置き換えます。
@param pattern 置き換える文字列のパターン
@param hash 置き換える文字列を与えるハッシュ
//emlist[例][ruby]{
hash = {'b'=>'B', 'c'=>'C'}
p "abcabc".gsub(/[bc]/){hash[$&]} #=> "aBCaBC"
p "abcabc".gsub(/[bc]/, hash) #=> "aBCaBC"
//} -
String
# sub(pattern , hash) -> String (310.0) -
文字列中の pattern にマッチした部分をキーにして hash を引いた値で置き換えます。
文字列中の pattern にマッチした部分をキーにして hash を引いた値で置き換えます。
@param pattern 置き換える文字列のパターン
@param hash 置き換える文字列を与えるハッシュ
//emlist[例][ruby]{
hash = {'b'=>'B', 'c'=>'C'}
p "abcabc".sub(/[bc]/){hash[$&]} #=> "aBCabc"
p "abcabc".sub(/[bc]/, hash) #=> "aBCabc"
//}