module Mincer
This should be extracted and moved to gem
This should be extracted and moved to gem
This and all processors are heavily influenced by pg_search(github.com/Casecommons/pg_search)
Public Class Methods
add_processor(processor)
click to toggle source
# File lib/mincer.rb, line 19 def self.add_processor(processor) processor_scope = ::Mincer::Processors.const_get(ActiveSupport::Inflector.camelize(processor.to_s, true)) ::Mincer.processors << processor_scope.const_get('Processor') ::Mincer::Base.send(:include, processor_scope.const_get('Options')) if processor_scope.const_defined?('Options') ::Mincer.config.add(processor, processor_scope.const_get('Configuration')) if processor_scope.const_defined?('Configuration') if processor_scope.const_defined?('Configuration') end
config()
click to toggle source
# File lib/mincer/config.rb, line 8 def self.config @config ||= ::Mincer::Configuration.new end
configure() { |config| ... }
click to toggle source
# File lib/mincer/config.rb, line 4 def self.configure yield(config) end
connection()
click to toggle source
# File lib/mincer.rb, line 15 def self.connection ::ActiveRecord::Base.connection() end
pg_extension_installed?(extension)
click to toggle source
# File lib/mincer.rb, line 26 def self.pg_extension_installed?(extension) @installed_extensions ||= {} if @installed_extensions[extension.to_sym].nil? @installed_extensions[extension.to_sym] = ::Mincer.connection.execute("SELECT DISTINCT p.proname FROM pg_proc p WHERE p.proname = '#{extension}'").count > 0 end @installed_extensions[extension.to_sym] end
postgres?()
click to toggle source
# File lib/mincer.rb, line 11 def self.postgres? self.connection.adapter_name == 'PostgreSQL' rescue false end
processors()
click to toggle source
# File lib/mincer.rb, line 7 def self.processors @processors ||= [] end
version()
click to toggle source
# File lib/mincer/version.rb, line 3 def self.version Gem::Version.new '0.2.20' end