module CustomAttributes
Constants
- VERSION
Public Class Methods
after_configuration()
click to toggle source
# File lib/custom_attributes.rb, line 48 def self.after_configuration # Set up ElasticSearch uri = URI(@config[:search_host]) if @config[:search_user].present? && @config[:search_pass].present? host = "#{uri.scheme}://#{@config[:search_user]}:#{@config[:search_pass]}@#{uri.host}" else host = "#{uri.scheme}://#{uri.host}" end host = "#{host}:#{uri.port}" if uri.port.present? Elasticsearch::Model.client = Elasticsearch::Client.new host: host end
config()
click to toggle source
# File lib/custom_attributes.rb, line 44 def self.config @config end
configure(opts = {})
click to toggle source
Configure through hash
# File lib/custom_attributes.rb, line 38 def self.configure(opts = {}) opts.each { |k, v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym } after_configuration end