Ruby 2.2.0 リファレンスマニュアル > ライブラリ一覧 > rexml/documentライブラリ > REXML::Attributeクラス > to_string

instance method REXML::Attribute#to_string

to_string -> String[permalink][rdoc]

"name='value'" という形式の文字列を返します。


require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").to_string # => "ns:r='rval'"