Module: Lexster::ModelAdditions::ClassMethods

Defined in:
lib/lexster/model_additions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lexster_configObject (readonly)

Returns the value of attribute lexster_config.



4
5
6
# File 'lib/lexster/model_additions.rb', line 4

def lexster_config
  @lexster_config
end

Instance Method Details

#lexsterable(options = {}) {|lexster_config| ... } ⇒ Object

Yields:



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/lexster/model_additions.rb', line 10

def lexsterable(options = {})
  # defaults
  lexster_config.auto_index = true
  lexster_config.enable_model_index = true # but the Lexster.enable_per_model_indexes is false by default. all models will be true only if the primary option is turned on.

  yield(lexster_config) if block_given?

  options.each do |key, value|
    raise "Lexster #{self.name} model options: No such option #{key}" unless lexster_config.respond_to?("#{key}=")
    lexster_config.send("#{key}=", value)
  end
end

#neo_model_index_nameObject



23
24
25
26
# File 'lib/lexster/model_additions.rb', line 23

def neo_model_index_name
  raise "Per Model index is not enabled. Nodes/Relationships are auto indexed with node_auto_index/relationship_auto_index" unless Lexster.config.enable_per_model_indexes || lexster_config.enable_model_index
  @index_name ||= "#{self.name.tableize}_index"
end