Module: Atom::SimpleExtensions

Included in:
Category, Entry, Feed
Defined in:
lib/atom.rb

Overview

Provides support for reading and writing simple extensions as defined by the Atom Syndication Format.

A Simple extension is an element from a non-atom namespace that has no attributes and only contains text content. It is interpreted as a key-value pair when the namespace and the localname of the extension make up the key. Since in XML you can have many instances of an element, the values are represented as an array of strings, so to manipulate the values manipulate the array returned by [ns, localname].

Defined Under Namespace

Classes: ValueProxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#simple_extensionsObject (readonly)

Returns the value of attribute simple_extensions.



33
34
35
# File 'lib/atom.rb', line 33

def simple_extensions
  @simple_extensions
end

Instance Method Details

#[](namespace, localname = nil) ⇒ Object

Gets a simple extension value for a given namespace and local name.

ns

The namespace.

localname

The local name of the extension element.



40
41
42
43
44
# File 'lib/atom.rb', line 40

def [](namespace, localname=nil)
  @simple_extensions ||= {}

  localname.nil? ? namespace_hash(namespace) : element_values(namespace, localname)
end