Module: Surveyor::ActsAsResponse
- Extended by:
- ActiveSupport::Concern
- Included in:
- Models::DependencyConditionMethods, Models::ResponseMethods, Models::ValidationConditionMethods
- 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
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/surveyor/acts_as_response.rb', line 6 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 |