Method: Statlysis::Configuration#similar_items

Defined in:
lib/statlysis/configuration.rb

#similar_items(model_name, id_to_text_hash = {}) ⇒ Object

TODO support mongoid



96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/statlysis/configuration.rb', line 96

def similar_items model_name, id_to_text_hash = {}
  _p = if block_given?
    (proc do
      id_to_text_hash = Hash.new {|hash, key| hash[key] = "" }
      yield id_to_text_hash
      id_to_text_hash
    end)
  else
    (proc { id_to_text_hash })
  end

  self.similar_crons.push Similar.new(model_name, _p)
end