module YeSQL
Constants
- BIND_REGEX
- VERSION
Public Class Methods
config()
click to toggle source
# File lib/yesql/config/configuration.rb, line 18 def config @config ||= ::YeSQL::Configuration.new end
configure() { |config| ... }
click to toggle source
# File lib/yesql/config/configuration.rb, line 22 def configure yield config if block_given? end
reset_config()
click to toggle source
# 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
Public Instance Methods
YeSQL(file_path, binds = {}, options = {})
click to toggle source
# 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
Private Instance Methods
execute(binds, file_path, output, prepare)
click to toggle source
# File lib/yesql.rb, line 31 def execute(binds, file_path, output, prepare) ::YeSQL::Query::Performer.new( bindings: binds, bind_statement: ::YeSQL::Statement.new(binds, file_path), file_path: file_path, output: output, prepare: prepare ).call end
validate(binds, file_path, output)
click to toggle source
# File lib/yesql.rb, line 25 def validate(binds, file_path, output) ::YeSQL::Errors::FilePathDoesNotExistError.new(file_path).validate_file_path_existence ::YeSQL::Errors::NoBindingsProvidedError.new(binds, file_path).validate_statement_bindings ::YeSQL::Errors::OutputArgumentError.new(output).validate_output_options end