Module: RubyRest::Atom::Extensions
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
33
34
35
|
# File 'lib/rubyrest/atom.rb', line 33
def method_missing( name, *args )
get_value( name )
end
|
Instance Method Details
#get_value(name, required = true) ⇒ Object
Resolves the missing method into a content property and returns its text value
22
23
24
25
26
27
|
# File 'lib/rubyrest/atom.rb', line 22
def get_value( name, required=true )
location = "/entry/rubyrest:content/#{name}"
value = text( location )
raise "missing value at location #{location} in #{self.to_s}" if required && (!value || value.length == 0)
return value
end
|
#new_copy ⇒ Object
37
38
39
|
# File 'lib/rubyrest/atom.rb', line 37
def new_copy
REXML::Document.new self.to_s
end
|
#set_value(name, value) ⇒ Object
29
30
31
|
# File 'lib/rubyrest/atom.rb', line 29
def set_value( name, value )
get_text( "/entry/rubyrest:content/#{name}" ).value = value
end
|