Class: Postgrest::Builders::BaseBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/postgrest/builders/base_builder.rb

Direct Known Subclasses

FilterBuilder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ BaseBuilder

Returns a new instance of BaseBuilder.



17
18
19
# File 'lib/postgrest/builders/base_builder.rb', line 17

def initialize(http)
  @http = http
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http.



15
16
17
# File 'lib/postgrest/builders/base_builder.rb', line 15

def http
  @http
end

Class Method Details

.before_execute(*values) ⇒ Object



11
12
13
# File 'lib/postgrest/builders/base_builder.rb', line 11

def self.before_execute(*values)
  @before_execute = values
end

.before_execute_hooksObject



6
7
8
9
# File 'lib/postgrest/builders/base_builder.rb', line 6

def self.before_execute_hooks
  @before_execute ||= []
  @before_execute
end

Instance Method Details

#callObject Also known as: execute



21
22
23
24
25
# File 'lib/postgrest/builders/base_builder.rb', line 21

def call
  self.class.before_execute_hooks.each { |method_name| send(method_name) }

  http.call
end