Module: Eql
- Defined in:
- lib/eql.rb,
lib/eql/proxy.rb,
lib/eql/config.rb,
lib/eql/builder.rb,
lib/eql/version.rb,
lib/eql/adapters/base.rb,
lib/eql/adapter_factory.rb,
lib/eql/adapters/active_record.rb
Overview
Eql module renders ERB query templates and runs them
Defined Under Namespace
Modules: Adapters Classes: AdapterFactory, Builder, Config, Proxy
Constant Summary collapse
- VERSION =
Returns gem version
'0.0.2'
Class Method Summary collapse
- .config ⇒ Eql::Config
-
.configure {|config| ... } ⇒ Object
Setup.
-
.execute(tmpl, params = nil) ⇒ Object
Execute a builder with template and params.
-
.load(tmpl, params = nil) ⇒ Eql::Builder
Load a builder with template and params.
-
.new(path = nil, conn = nil) ⇒ Object
Create new builder.
- .register_adapter(key, klass) ⇒ Object
-
.template(erb) ⇒ Eql::Builder
Load a builder with template content.
Class Method Details
.configure {|config| ... } ⇒ Object
Setup
63 64 65 |
# File 'lib/eql.rb', line 63 def configure yield(config) end |
.execute(tmpl, params = nil) ⇒ Object
Execute a builder with template and params
38 39 40 |
# File 'lib/eql.rb', line 38 def execute(tmpl, params = nil) load(tmpl, params).execute end |
.load(tmpl, params = nil) ⇒ Eql::Builder
Load a builder with template and params
26 27 28 |
# File 'lib/eql.rb', line 26 def load(tmpl, params = nil) new.tap { |b| b.load(tmpl, params) } end |
.new(path = nil, conn = nil) ⇒ Object
Create new builder
14 15 16 |
# File 'lib/eql.rb', line 14 def new(path = nil, conn = nil) Builder.new(path || config.path, conn) end |
.register_adapter(key, klass) ⇒ Object
70 71 72 |
# File 'lib/eql.rb', line 70 def register_adapter(key, klass) AdapterFactory.register_adapter(key, klass) end |
.template(erb) ⇒ Eql::Builder
Load a builder with template content
49 50 51 |
# File 'lib/eql.rb', line 49 def template(erb) new.tap { |b| b.template(erb) } end |