別のキーワード
種類
- インスタンスメソッド (189)
- 文書 (24)
- 特異メソッド (24)
ライブラリ
- ビルトイン (105)
-
rexml
/ document (36) - shell (24)
-
shell
/ command-processor (24) -
shell
/ filter (24)
クラス
-
Enumerator
:: Lazy (93) -
REXML
:: Element (24) -
REXML
:: XPath (12) - Range (12)
- Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (24)
キーワード
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- cat (18)
- chunk (24)
-
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) - echo (18)
- glob (18)
- new (12)
-
ruby 1
. 6 feature (12) -
slice
_ after (22) -
slice
_ before (36) -
slice
_ when (11) - tee (18)
検索結果
先頭5件
- REXML
:: XPath . each(element , path = nil , namespaces = {} , variables = {}) {|e| . . . } -> () - REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () - REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () - ruby 1
. 6 feature - Rubyで使われる記号の意味(正規表現の複雑な記号は除く)
-
REXML
:: XPath . each(element , path = nil , namespaces = {} , variables = {}) {|e| . . . } -> () (18119.0) -
element の path で指定した XPath 文字列にマッチする各ノード に対してブロックを呼び出します。
...変数名とその値の対応付け
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS
REXML::XPath.each(doc, "/root/a/b"){|e| p e.text }
# >> "b1"
# >> "b2"
//}... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (6167.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...)
doc.root.each_element_with_attribute('id'){|e| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }
# >> <b id='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_wi......th_attribute('id', '1', 0, 'd'){|e| p e }
# >> <d id='1'/>
//}... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (6167.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...oc.root.each_element_with_text {|e|p e}
# >> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >> <c> ... </>
doc.root.each_element_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ...... -
ruby 1
. 6 feature (54.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...Fixnum#>>, <<
負の数に対して右シフトすると 0 になることがありました。
((<ruby-bugs-ja:PR#247>))
負の数を引数にした左シフト(つまり右シフト)も同様におかしな挙動をして
いました。((<ruby-bugs-ja:PR#248>))
p(-1 >> 31)......2002-03-10 メソッドの戻り値
以下のメソッドの戻り値が正しくなりました。((<ruby-bugs-ja:PR#205>))
* ((<Enumerable/each_with_index>)) が self を返すようになった(以前は nil)
* ((<Process/Process.setpgrp>)) が返す値が不定だった。
* ((<String......返すようになった(以前は false)
* IO#close がクローズ済みな IO に対して IOError を起こすようになった。
* IO#each_byte が self を返すようになった(以前は nil)
: rb_define_module_under()
C 関数 rb_define_module_under() でモジュールを定... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (36.0)
-
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or plus minus ast slash hat sq period comma langl rangl eq tilde dollar at under lbrarbra lbra2rbra2 lbra3rbra3 dq colon ac backslash semicolon
...ント。d:spec/m17n#magic_comment を参照。
: "a is #{a}"
d:spec/literal#exp
//emlist{
a = 10
p "a is #{a}" #=> "a is 10"
//}
: Range#each
説明文の中でのみ使われます。Ruby言語の要素ではありません。クラスのインスタンスメソッドであることを......ソッド/モジュールの
モジュールメソッドを示すことに使われます。一方、インスタンスメソッドは「Range#each」のように
「#」でつなぎます。
: 1 .. 20
最大値を含む Range オブジェクトを作る範囲演算子です。全体で範囲......れば -1
を返すように作ることが期待されています。
: 3 >> 1
シフト演算子。または類似のメソッド。
: a >>= 1
「>>」演算子の自己代入演算子。
//emlist{
a = 3
a >>= 1
p a #=> 1
//}
: { 1 => "11" , 3 => "333" }
ハッシュのリテラル... -
Range
. new(first , last , exclude _ end = false) -> Range (24.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...ge.new(Date.today, Date.today >> 1).each {|d| puts d }
# => 2017-09-16
# 2017-09-17
# ...
# 2017-10-16
//}
//emlist[例: IPアドレスの範囲オブジェクトの場合][ruby]{
require 'ipaddr'
Range.new(IPAddr.new("192.0.2.1"), IPAddr.new("192.0.2.3")).each {|ip| puts ip}
# => 192.0.2.......のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end
def <=>(other)
value <=> other.value
end
def to_s
value.to_s
end
end
Range.new(MyInteger.new(1), MyInteger.new(3)).each {|i| puts i }
# => 1
# 2
# 3
//}... -
Shell
# cat(*files) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...ファイル名を文字列で指定します。
動作例
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") >> "all.tee"
}
}
}... -
Shell
# echo(*strings) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...与える引数を文字列で指定します。
動作例
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") >> "all.tee"
}
}
}... -
Shell
# glob(pattern) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...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|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}
@see Dir.[]... -
Shell
# tee(file) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...るファイル名を文字列で指定します。
動作例
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") >> "all.tee"
}
}
}... -
Shell
:: CommandProcessor # cat(*files) -> Shell :: Filter (18.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...ファイル名を文字列で指定します。
動作例
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") >> "all.tee"
}
}
}...