Class: LogMagic::SearchkickExplainer::SettingsExplainerSection

Inherits:
Object
  • Object
show all
Includes:
JSONUtils, TemplatingUtils
Defined in:
lib/log_magic/explainers/searchkick/settings_explainer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JSONUtils

#parse_json, #pretty_print_json, #query_hash

Methods included from TemplatingUtils

#enriche, #match_regex, #rendered_template, #template_dir, #template_path

Constructor Details

#initialize(elasticsearch_url, query_explainer) ⇒ SettingsExplainerSection

Returns a new instance of SettingsExplainerSection.



6
7
8
9
10
# File 'lib/log_magic/explainers/searchkick/settings_explainer.rb', line 6

def initialize(elasticsearch_url, query_explainer)
  @query_explainer = query_explainer
  @elasticsearch_url = elasticsearch_url
  enriche_query_json
end

Instance Attribute Details

#elasticsearch_urlObject (readonly)

Returns the value of attribute elasticsearch_url.



4
5
6
# File 'lib/log_magic/explainers/searchkick/settings_explainer.rb', line 4

def elasticsearch_url
  @elasticsearch_url
end

Instance Method Details

#enriche_query_jsonObject



24
25
26
27
# File 'lib/log_magic/explainers/searchkick/settings_explainer.rb', line 24

def enriche_query_json
  explainer = ::LogMagic::SearchkickExplainer::CustomAnalyzerHover.new(@query_explainer, index_settings)
  explainer.enriche
end

#explanationObject



16
17
18
# File 'lib/log_magic/explainers/searchkick/settings_explainer.rb', line 16

def explanation
  rendered_template
end

#index_settingsObject



12
13
14
# File 'lib/log_magic/explainers/searchkick/settings_explainer.rb', line 12

def index_settings
  @index_settings ||= `curl #{elasticsearch_url}/_settings`
end

#template_nameObject



20
21
22
# File 'lib/log_magic/explainers/searchkick/settings_explainer.rb', line 20

def template_name
  'settings.haml'
end