Class: Neoid::ModelConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/neoid/model_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ ModelConfig

Returns a new instance of ModelConfig.



9
10
11
# File 'lib/neoid/model_config.rb', line 9

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#auto_indexObject

Returns the value of attribute auto_index.



7
8
9
# File 'lib/neoid/model_config.rb', line 7

def auto_index
  @auto_index
end

#enable_model_indexObject

Returns the value of attribute enable_model_index.



6
7
8
# File 'lib/neoid/model_config.rb', line 6

def enable_model_index
  @enable_model_index
end

#propertiesObject (readonly)

Returns the value of attribute properties.



3
4
5
# File 'lib/neoid/model_config.rb', line 3

def properties
  @properties
end

#relationship_optionsObject (readonly)

Returns the value of attribute relationship_options.



5
6
7
# File 'lib/neoid/model_config.rb', line 5

def relationship_options
  @relationship_options
end

#search_optionsObject (readonly)

Returns the value of attribute search_options.



4
5
6
# File 'lib/neoid/model_config.rb', line 4

def search_options
  @search_options
end

Instance Method Details

#field(name, &block) ⇒ Object



17
18
19
# File 'lib/neoid/model_config.rb', line 17

def field(name, &block)
  stored_fields[name] = block
end

#inspectObject



31
32
33
# File 'lib/neoid/model_config.rb', line 31

def inspect
  "#<Neoid::ModelConfig @properties=#{properties.inspect} @search_options=#{@search_options.inspect}>"
end

#relationship(options) ⇒ Object



21
22
23
# File 'lib/neoid/model_config.rb', line 21

def relationship(options)
  @relationship_options = options
end

#search(&block) ⇒ Object



25
26
27
28
29
# File 'lib/neoid/model_config.rb', line 25

def search(&block)
  raise 'search needs a block' unless block_given?
  @search_options = SearchConfig.new
  block.call(@search_options)
end

#stored_fieldsObject



13
14
15
# File 'lib/neoid/model_config.rb', line 13

def stored_fields
  @stored_fields ||= {}
end