Sha256: f399bc5d18b9d5a8b83757db01d0fbbbb58e18680dc66ff082066549ae2f5b83
Contents?: true
Size: 514 Bytes
Versions: 28
Compression:
Stored size: 514 Bytes
Contents
module Surveyor module ActsAsResponse # Returns the response as a particular response_class type 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 end end
Version data entries
28 entries across 28 versions & 3 rubygems