Module: Doorkeeper::Models::ExpirationTimeSqlMath::ClassMethods

Defined in:
lib/doorkeeper/models/concerns/expiration_time_sql_math.rb

Instance Method Summary collapse

Instance Method Details

#adapter_nameObject



82
83
84
# File 'lib/doorkeeper/models/concerns/expiration_time_sql_math.rb', line 82

def adapter_name
  ActiveRecord::Base.connection.adapter_name
end

#expiration_time_sqlObject



70
71
72
73
74
75
76
# File 'lib/doorkeeper/models/concerns/expiration_time_sql_math.rb', line 70

def expiration_time_sql
  if respond_to?(:custom_expiration_time_sql)
    custom_expiration_time_sql
  else
    expiration_time_sql_expression
  end
end

#expiration_time_sql_expressionObject



78
79
80
# File 'lib/doorkeeper/models/concerns/expiration_time_sql_math.rb', line 78

def expiration_time_sql_expression
  ADAPTERS_MAPPING.fetch(adapter_name.downcase).new(self).generate_sql
end

#supports_expiration_time_math?Boolean

Returns:

  • (Boolean)


65
66
67
68
# File 'lib/doorkeeper/models/concerns/expiration_time_sql_math.rb', line 65

def supports_expiration_time_math?
  ADAPTERS_MAPPING.key?(adapter_name.downcase) ||
    respond_to?(:custom_expiration_time_sql)
end