Class: QuickCount::Adapters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/quick_count/adapters/base.rb

Direct Known Subclasses

Mysql, Postgresql

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection:) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/quick_count/adapters/base.rb', line 6

def initialize(connection:)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/quick_count/adapters/base.rb', line 4

def connection
  @connection
end

Instance Method Details

#count_estimate(query) ⇒ Object

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/quick_count/adapters/base.rb', line 15

def count_estimate(query)
  raise NotImplementedError, "#{self.class} must implement #count_estimate"
end

#quick_count(table_name, threshold: nil) ⇒ Object

Abstract methods that must be implemented by adapters

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/quick_count/adapters/base.rb', line 11

def quick_count(table_name, threshold: nil)
  raise NotImplementedError, "#{self.class} must implement #quick_count"
end

#supported?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/quick_count/adapters/base.rb', line 19

def supported?
  raise NotImplementedError, "#{self.class} must implement #supported?"
end