Module: AppQuery

Defined in:
lib/app_query.rb,
lib/app_query/version.rb,
lib/app_query/tokenizer.rb,
lib/app_query/rspec/helpers.rb

Defined Under Namespace

Modules: RSpec Classes: Configuration, Error, Q, Result, Tokenizer

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.[](v) ⇒ Object



27
28
29
30
31
# File 'lib/app_query.rb', line 27

def self.[](v)
  query_name = v.to_s
  full_path = (Pathname.new(configuration.query_path) / "#{query_name}.sql").expand_path
  Q.new(full_path.read, name: "AppQuery #{query_name}")
end

.configurationObject



12
13
14
# File 'lib/app_query.rb', line 12

def self.configuration
  @configuration ||= AppQuery::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



16
17
18
# File 'lib/app_query.rb', line 16

def self.configure
  yield configuration if block_given?
end

.reset_configuration!Object



20
21
22
23
24
# File 'lib/app_query.rb', line 20

def self.reset_configuration!
  configure do |config|
    config.query_path = "app/queries"
  end
end