Module: Get

Extended by:
Horza::SharedConfig
Defined in:
lib/get.rb,
lib/get/db.rb,
lib/get/errors.rb,
lib/get/parser.rb,
lib/get/version.rb,
lib/get/builders.rb,
lib/get/run_methods.rb,
lib/get/builders/base_builder.rb,
lib/get/builders/join_builder.rb,
lib/get/builders/query_builder.rb,
lib/get/builders/ancestry_builder.rb

Defined Under Namespace

Modules: Builders, Errors, RunMethods Classes: Db, Parser

Constant Summary collapse

GET_CLASS_REGEX =
/^(.*)(By|From)(.*)/
VERSION =
'1.0.0'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object



26
27
28
29
30
# File 'lib/get.rb', line 26

def const_missing(name)
  parser = ::Get::Parser.new(name)
  return super(name) unless parser.match?
  Builders.generate_class(name, parser.method)
end

.included(base) ⇒ Object



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

def included(base)
  base.class_eval do
    extend ::Get::RunMethods
  end
end

Instance Method Details

#runObject



33
34
35
36
# File 'lib/get.rb', line 33

def run
  run!
rescue ::Get::Errors::Base, Get::Errors::RecordNotFound
end

#run!Object



38
39
40
41
42
# File 'lib/get.rb', line 38

def run!
  call
rescue *Get.adapter.expected_horza_errors => e
  raise ::Get::Errors::Base.new(e.message)
end