るりまサーチ

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

別のキーワード

  1. module attr
  2. net/imap attr
  3. _builtin attr
  4. rdoc attr_modifiers
  5. etc sc_thread_attr_stacksize

ライブラリ

クラス

検索結果

REXML::Attributes#each_attribute {|attribute| ... } -> () (30331.0)

各属性に対しブロックを呼び出します。

...は REXML::Attribute オブジェクトで渡されます。

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/r...
...oot/a").first

a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}...