module Eql

Eql module renders ERB query templates and runs them

Constants

VERSION

@return [String] returns gem version

Public Class Methods

config() click to toggle source

@return [Eql::Config]

# File lib/eql.rb, line 57
def config
  @config ||= Config.new
end
configure() { |config| ... } click to toggle source

Setup

# File lib/eql.rb, line 64
def configure
  yield(config)
end
execute(tmpl, params = nil) click to toggle source

Execute a builder with template and params

@param [String, Symbol] tmpl template's name @param [Object, nil] params template's params

@return [Object] returns excution results

# File lib/eql.rb, line 39
def execute(tmpl, params = nil)
  load(tmpl, params).execute
end
load(tmpl, params = nil) click to toggle source

Load a builder with template and params

@param [String, Symbol] tmpl template's name @param [Object, nil] params template's params

@return [Eql::Builder]

# File lib/eql.rb, line 27
def load(tmpl, params = nil)
  new.tap { |b| b.load(tmpl, params) }
end
new(path = nil, conn = nil) click to toggle source

Create new builder

@param [Array<String>, String, nil] path template's root folder @param [Object, nil] conn DB connection or cursor

# File lib/eql.rb, line 15
def new(path = nil, conn = nil)
  Builder.new(path || config.path, conn)
end
register_adapter(key, klass) click to toggle source

@see Eql::AdapterFactory#redister_adapter

# File lib/eql.rb, line 71
def register_adapter(key, klass)
  AdapterFactory.register_adapter(key, klass)
end
template(erb) click to toggle source

Load a builder with template content

@param [String] erb template's content

@return [Eql::Builder]

# File lib/eql.rb, line 50
def template(erb)
  new.tap { |b| b.template(erb) }
end