Module: Tanker::InstanceMethods

Defined in:
lib/tanker.rb

Overview

these are the instace methods included que

Instance Method Summary collapse

Instance Method Details

#delete_tank_indexesObject



117
118
119
# File 'lib/tanker.rb', line 117

def delete_tank_indexes
  self.class.index.delete_document(it_doc_id)
end

#it_doc_idObject



121
122
123
# File 'lib/tanker.rb', line 121

def it_doc_id
  self.class.name + ' ' + self.id.to_s
end

#tanker_indexesObject



99
100
101
# File 'lib/tanker.rb', line 99

def tanker_indexes
  self.class.tanker_indexes
end

#update_tank_indexesObject



103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/tanker.rb', line 103

def update_tank_indexes
  data = {}

  tanker_indexes.each do |field|
    val = self.instance_eval(field.to_s)
    data[field.to_s] = val.to_s unless val.nil?
  end

  data[:__any] = data.values.join " . "
  data[:__type] = self.class.name

  self.class.index.add_document(it_doc_id, data)
end