Class: Lexster::ModelConfig
- Inherits:
-
Object
- Object
- Lexster::ModelConfig
- Defined in:
- lib/lexster/model_config.rb
Instance Attribute Summary collapse
-
#auto_index ⇒ Object
Returns the value of attribute auto_index.
-
#enable_model_index ⇒ Object
Returns the value of attribute enable_model_index.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#relationship_options ⇒ Object
readonly
Returns the value of attribute relationship_options.
-
#search_options ⇒ Object
readonly
Returns the value of attribute search_options.
Instance Method Summary collapse
- #field(name, &block) ⇒ Object
-
#initialize(klass) ⇒ ModelConfig
constructor
A new instance of ModelConfig.
- #inspect ⇒ Object
- #relationship(options) ⇒ Object
- #search(&block) ⇒ Object
- #stored_fields ⇒ Object
Constructor Details
#initialize(klass) ⇒ ModelConfig
Returns a new instance of ModelConfig.
9 10 11 |
# File 'lib/lexster/model_config.rb', line 9 def initialize(klass) @klass = klass end |
Instance Attribute Details
#auto_index ⇒ Object
Returns the value of attribute auto_index.
7 8 9 |
# File 'lib/lexster/model_config.rb', line 7 def auto_index @auto_index end |
#enable_model_index ⇒ Object
Returns the value of attribute enable_model_index.
6 7 8 |
# File 'lib/lexster/model_config.rb', line 6 def enable_model_index @enable_model_index end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
3 4 5 |
# File 'lib/lexster/model_config.rb', line 3 def properties @properties end |
#relationship_options ⇒ Object (readonly)
Returns the value of attribute relationship_options.
5 6 7 |
# File 'lib/lexster/model_config.rb', line 5 def @relationship_options end |
#search_options ⇒ Object (readonly)
Returns the value of attribute search_options.
4 5 6 |
# File 'lib/lexster/model_config.rb', line 4 def @search_options end |
Instance Method Details
#field(name, &block) ⇒ Object
17 18 19 |
# File 'lib/lexster/model_config.rb', line 17 def field(name, &block) self.stored_fields[name] = block end |
#inspect ⇒ Object
31 32 33 |
# File 'lib/lexster/model_config.rb', line 31 def inspect "#<Lexster::ModelConfig @properties=#{properties.inspect} @search_options=#{@search_options.inspect}>" end |
#relationship(options) ⇒ Object
21 22 23 |
# File 'lib/lexster/model_config.rb', line 21 def relationship() @relationship_options = end |
#search(&block) ⇒ Object
25 26 27 28 29 |
# File 'lib/lexster/model_config.rb', line 25 def search(&block) raise "search needs a block" unless block_given? @search_options = SearchConfig.new block.(@search_options) end |
#stored_fields ⇒ Object
13 14 15 |
# File 'lib/lexster/model_config.rb', line 13 def stored_fields @stored_fields ||= {} end |