Module: YeSQL

Includes:
Config
Defined in:
lib/yesql.rb,
lib/yesql/version.rb,
lib/yesql/statement.rb,
lib/yesql/utils/read.rb,
lib/yesql/query/result.rb,
lib/yesql/params/output.rb,
lib/yesql/bindings/utils.rb,
lib/yesql/common/adapter.rb,
lib/yesql/query/performer.rb,
lib/yesql/bindings/extract.rb,
lib/yesql/bindings/extractor.rb,
lib/yesql/bindings/transformed.rb,
lib/yesql/config/configuration.rb,
lib/yesql/query/transform_result.rb,
lib/yesql/errors/output_argument_error.rb,
lib/yesql/errors/no_bindings_provided_error.rb,
lib/yesql/errors/file_path_does_not_exist_error.rb

Defined Under Namespace

Modules: Bindings, Common, Config, Errors, Params, Query, Utils Classes: Statement

Constant Summary collapse

BIND_REGEX =
/(?<!:):(\w+)(?=\b)/
VERSION =
"0.2.4"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configObject



18
19
20
# File 'lib/yesql/config/configuration.rb', line 18

def config
  @config ||= ::YeSQL::Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



22
23
24
# File 'lib/yesql/config/configuration.rb', line 22

def configure
  yield config if block_given?
end

.reset_configObject



26
27
28
29
30
31
32
# File 'lib/yesql/config/configuration.rb', line 26

def reset_config
  tap do |conf|
    conf.configure do |configuration|
      configuration.path = ::YeSQL::Configuration::DEFAULT_PATH
    end
  end
end

Instance Method Details

#YeSQL(file_path, binds = {}, options = {}) ⇒ Object



16
17
18
19
20
21
# File 'lib/yesql.rb', line 16

def YeSQL(file_path, binds = {}, options = {})
  output = options[:output] || :rows

  validate(binds, file_path, output)
  execute(binds, file_path, output, options[:prepare])
end