Class: Atom::AttrEl

Inherits:
Element show all
Defined in:
lib/atom/element.rb,
lib/atom/yaml.rb

Overview

this facilitates YAML output

Direct Known Subclasses

Category, Link

Instance Attribute Summary

Attributes inherited from Element

#base, #extensions

Instance Method Summary collapse

Methods inherited from Element

#[], #[]=, attrb, attrs, define_accessor, element, elements, inherited, #initialize, #local_name, required, #taguri, #to_element, #to_s, #to_xml, #to_yaml_properties

Constructor Details

This class inherits a constructor from Atom::Element

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/atom/yaml.rb', line 32

def to_yaml( opts = {} )
  YAML::quick_emit( object_id, opts ) do |out|
    out.map( nil, to_yaml_style ) do |map|
      self.class.attrs.each do |n,r|
        map.add( n.to_s, self[n.to_s] ) if self[n.to_s]
      end
    end
  end
end