Class: RecordsRip::WhereEpitaph

Inherits:
Object
  • Object
show all
Defined in:
lib/records_rip/where_epitaph.rb

Instance Method Summary collapse

Constructor Details

#initialize(tomb_model_class, attributes) ⇒ WhereEpitaph

Returns a new instance of WhereEpitaph.



3
4
5
6
# File 'lib/records_rip/where_epitaph.rb', line 3

def initialize(tomb_model_class, attributes)
  @tomb_model_class = tomb_model_class
  @attributes = attributes
end

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/records_rip/where_epitaph.rb', line 8

def execute
  column = @tomb_model_class.columns_hash["epitaph"]
  raise "where_epitaph can't be called without an epitaph column" unless column

  case column.type
  when :jsonb
    jsonb
  when :json
    json
  else
    text
  end
end