Class: RubyRest::Atom::Entry::Document

Inherits:
REXML::Document
  • Object
show all
Defined in:
lib/rubyrest/atom.rb

Overview

Adds some convenience methods to a standard REXML document. This class supposes that the document is an Atom entry

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Resolves the missing method into a content property and returns its text value

[View source]

164
165
166
167
168
169
170
# File 'lib/rubyrest/atom.rb', line 164

def method_missing( name, *args )
  location = "/entry/moodisland:content/#{name}"
  method_name = name.to_s.chomp
  if method_name == name.to_s
    text( location )
  else get_text( location ).value = args[0] end
end

Instance Method Details

#cloneObject

Overrides the default implementation by returning a new Ruby-on-Rest Atom Document

[View source]

180
181
182
# File 'lib/rubyrest/atom.rb', line 180

def clone
  self.class.new self.to_s
end

#idObject

Shortcut for the id element contained within the content.

[View source]

174
175
176
# File 'lib/rubyrest/atom.rb', line 174

def id
  text( "/entry/moodisland:content/id" )
end