Module: Kangaru

Defined in:
lib/kangaru/paths.rb,
lib/kangaru.rb,
lib/kangaru/model.rb,
lib/kangaru/config.rb,
lib/kangaru/router.rb,
lib/kangaru/concern.rb,
lib/kangaru/request.rb,
lib/kangaru/version.rb,
lib/kangaru/database.rb,
lib/kangaru/renderer.rb,
lib/kangaru/interface.rb,
lib/kangaru/validator.rb,
lib/kangaru/controller.rb,
lib/kangaru/validators.rb,
lib/kangaru/application.rb,
lib/kangaru/initialiser.rb,
lib/kangaru/path_parser.rb,
lib/kangaru/configurator.rb,
lib/kangaru/configurators.rb,
lib/kangaru/patches/source.rb,
lib/kangaru/argument_parser.rb,
lib/kangaru/request_builder.rb,
lib/kangaru/validation/error.rb,
lib/kangaru/initialisers/rspec.rb,
lib/kangaru/patches/symboliser.rb,
lib/kangaru/patches/constantise.rb,
lib/kangaru/patches/inflections.rb,
lib/kangaru/components/component.rb,
lib/kangaru/concerns/validatable.rb,
lib/kangaru/inflectors/inflector.rb,
lib/kangaru/inflectors/tokeniser.rb,
lib/kangaru/concerns/attributable.rb,
lib/kangaru/concerns/configurable.rb,
lib/kangaru/inflectors/constantiser.rb,
lib/kangaru/inflectors/path_inflector.rb,
lib/kangaru/inflectors/class_inflector.rb,
lib/kangaru/inflectors/human_inflector.rb,
lib/kangaru/validation/model_validator.rb,
lib/kangaru/inflectors/inflector_macros.rb,
lib/kangaru/inflectors/constant_inflector.rb,
lib/kangaru/validators/required_validator.rb,
lib/kangaru/inflectors/snakecase_inflector.rb,
lib/kangaru/validation/attribute_validator.rb,
lib/kangaru/initialisers/rspec/kangaru_helper.rb,
lib/kangaru/initialisers/rspec/request_helper.rb,
lib/kangaru/configurators/request_configurator.rb,
lib/kangaru/configurators/database_configurator.rb,
lib/kangaru/inflectors/screaming_snakecase_inflector.rb

Overview

Builds Pathname objects for files inside a Ruby gem application. Note that this assumes a conventional Ruby gem file structure.

For example:

+ some_gem/          (gem_dir)
| + lib/             (lib_dir)
| |-- some_gem.rb    (source)
| | + some_gem/      (app_dir)
| | |-- some_file.rb (path)

Defined Under Namespace

Modules: Attributable, Concern, Configurable, Configurators, Inflectors, Initialiser, Initialisers, Interface, Patches, Validatable, Validation, Validators Classes: Application, ArgumentParser, Component, Config, Configurator, Controller, Database, PathParser, Paths, Renderer, Request, RequestBuilder, Router, Validator

Constant Summary collapse

COLLAPSED_DIRS =
[
  "#{__dir__}/kangaru/components",
  "#{__dir__}/kangaru/concerns"
].freeze
DEFAULT_ENV =
:runtime
INFLECTIONS =
{
  "rspec" => "RSpec"
}.freeze
Model =
Class.new(Sequel::Model) do
  include Validatable
end
VERSION =
"0.2.4".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.applicationObject

Returns the value of attribute application.



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

def application
  @application
end

Class Method Details

.application!Object



35
36
37
# File 'lib/kangaru.rb', line 35

def application!
  application || raise("application not set")
end

.eager_load(namespace) ⇒ Object



51
52
53
# File 'lib/kangaru.rb', line 51

def eager_load(namespace)
  @loader.eager_load_namespace(namespace)
end

.envObject



43
44
45
# File 'lib/kangaru.rb', line 43

def env
  @env ||= DEFAULT_ENV
end

.env=(value) ⇒ Object



39
40
41
# File 'lib/kangaru.rb', line 39

def env=(value)
  @env = value.to_sym
end

.env?(value) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/kangaru.rb', line 47

def env?(value)
  env == value
end

.test?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/kangaru.rb', line 55

def test?
  env == :test
end