class InvoiceForm attr_reader :params def initialize(params) @params = params end def billing_date Time.new(params[:year], params[:month], params[:day]) if time_data_present? rescue ArgumentError end def company_name params[:_messed_up_company_name] || params[:company_name] end def valid? billing_date.present? && company_name.present? end private def time_data_present? [params[:year], params[:month], params[:day]].all?(&:present?) end end form = InvoiceForm.new({year: "2014", month: "07", day: "18"}) form.billing_date # => Time instance