Module: Elastify
- Defined in:
- lib/elastify.rb,
lib/elastify/version.rb,
lib/elastify/elastic_search_helper.rb,
lib/elastify/active_record_extensions.rb
Defined Under Namespace
Modules: ActiveRecordExtensions, ElasticSearchHelper
Classes: ElastifyError
Constant Summary
collapse
- VERSION =
"0.1.5"
Class Method Summary
collapse
Class Method Details
.configs ⇒ Object
26
27
28
|
# File 'lib/elastify.rb', line 26
def configs
return Rails.application.config.elastify[:configs]
end
|
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/elastify.rb', line 7
def configure &block
mappings = {}
configs = OpenStruct.new({
base_url: "http://localhost:9200",
mappings_path: Rails.root.join("config/elastify/mappings")
})
block.call(configs) if block_given?
dir = configs.mappings_path
if Dir.exist?(dir)
Dir.glob("#{dir}/*.json") do |file_path|
mappings[File.basename(file_path, ".json")] = JSON.parse(File.read(file_path))
end
end
Rails.application.config.elastify = {
configs: configs,
mappings: mappings,
}
end
|
.mappings ⇒ Object
30
31
32
|
# File 'lib/elastify.rb', line 30
def mappings
return Rails.application.config.elastify[:mappings]
end
|