Class: RubyRest::Atom::DateProperty
Class Method Summary
collapse
Instance Method Summary
collapse
#bind, #format, #initialize, #object_value, #parse, #tag, #xml_value
Class Method Details
152
153
154
155
|
# File 'lib/rubyrest/atom.rb', line 152
def self.format_date( date )
date = Time.now if !date
date.strftime( ATOM_DATE_FORMAT )
end
|
Instance Method Details
#date2string(date) ⇒ Object
157
158
159
|
# File 'lib/rubyrest/atom.rb', line 157
def date2string( date )
self.class.format_date( date )
end
|
#string2date(date) ⇒ Object
161
162
163
|
# File 'lib/rubyrest/atom.rb', line 161
def string2date( date )
Date.strptime( value, ATOM_DATE_FORMAT )
end
|
#value_from_model(options, object) ⇒ Object
165
166
167
|
# File 'lib/rubyrest/atom.rb', line 165
def value_from_model( options, object )
date2string( object_value( object, options ) )
end
|
#value_from_xml(options, xml) ⇒ Object
169
170
171
|
# File 'lib/rubyrest/atom.rb', line 169
def value_from_xml( options, xml )
string2date( xml_value( xml, options ) )
end
|