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

class REXML::Attributes

クラス・モジュールの継承リスト: REXML::Attributes < Hash < Enumerable < Object < Kernel < BasicObject

要約

属性の集合を表すクラスです。

REXML::Element#attributes はこのクラスのオブジェクトを返します。各属性には REXML::Attributes#[] でアクセスします。

特異メソッド

定義 説明
new(element) -> REXML::Attributes

空の Attributes オブジェクトを生成します。

インスタンスメソッド

定義 説明
add(attribute) -> ()
self << attribute -> ()

属性を追加/更新します。

self[name] -> String | nil

属性名nameの属性値を返します。

self[name] = value

指定した属性を更新します。

delete(attribute) -> REXML::Element

指定した属性を取り除きます。

delete_all(name) -> [REXML::Attribute]

name という名前を持つ属性をすべて削除します。

each {|name, value| ... } -> ()

各属性の名前と値に対しブロックを呼び出します。

each_attribute {|attribute| ... } -> ()

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

get_attribute(name) -> Attribute | nil

name という名前の属性を取得します。

get_attribute_ns(namespace, name) -> REXML::Attribute | nil

namespace と name で特定される属性を返します。

length -> Integer
size -> Integer

属性の個数を返します。

namespaces -> { String => String }

self の中で宣言されている名前空間の集合を返します。

prefixes -> [String]

self の中で宣言されている prefix の集合を文字列の配列で返します。

to_a -> [Attribute]

属性の配列を返します。

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined all? any? chunk chunk_while collect collect_concat count cycle detect drop drop_while each_cons each_entry each_slice each_with_index each_with_object entries find_all find_index first grep grep_v group_by include? inject lazy max max_by min min_by minmax minmax_by none? one? partition reject reverse_each slice_after slice_before slice_when sort sort_by sum take take_while to_h to_set uniq zip < <= == > >= []= assoc clear clone compare_by_identity compare_by_identity? default default= default_proc default_proc= delete_if dig each each_key each_value empty? equal? fetch fetch_values flatten has_key? has_value? hash index inspect invert keep_if keys merge merge! rassoc rehash replace shift to_hash to_proc values values_at .[] .try_convert !~ <=> =~ _dump class define_singleton_method display enum_for extend freeze frozen? initialize initialize_copy instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself marshal_dump marshal_load method methods nil? object_id pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods psych_to_yaml public_method public_methods public_send remove_instance_variable respond_to? respond_to_missing? send singleton_class singleton_method singleton_methods taint tainted? tap to_ary to_int to_io to_regexp to_str trust untaint untrust untrusted? .yaml_tag ::ARGF ::ARGV ::DATA ::ENV ::FALSE ::NIL ::RUBY_COPYRIGHT ::RUBY_DESCRIPTION ::RUBY_ENGINE ::RUBY_ENGINE_VERSION ::RUBY_PATCHLEVEL ::RUBY_PLATFORM ::RUBY_RELEASE_DATE ::RUBY_REVISION ::RUBY_VERSION ::SCRIPT_LINES__ ::STDERR ::STDIN ::STDOUT ::TOPLEVEL_BINDING ::TRUE