Module: Surveyor::Response::InstanceMethods
- Defined in:
- lib/surveyor/acts_as_response.rb
Instance Method Summary collapse
-
#as(type_symbol) ⇒ Object
Returns the response as a particular response_class type.
Instance Method Details
#as(type_symbol) ⇒ Object
Returns the response as a particular response_class type
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/surveyor/acts_as_response.rb', line 17 def as(type_symbol) return case type_symbol.to_sym when :string, :text, :integer, :float, :datetime self.send("#{type_symbol}_value".to_sym) when :date self.datetime_value.nil? ? nil : self.datetime_value.to_date when :time self.datetime_value.nil? ? nil : self.datetime_value.to_time else # :answer_id self.answer_id end end |