Module: Hangar

Defined in:
lib/hangar.rb,
lib/hangar/engine.rb,
lib/hangar/version.rb,
lib/hangar/constraint.rb,
app/controllers/hangar/records_controller.rb,
app/controllers/hangar/resources_controller.rb

Defined Under Namespace

Classes: Engine, RecordsController, ResourcesController, RouteConstraint

Constant Summary collapse

BadEnvironmentError =
Class.new(StandardError)
VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.do_not_deleteObject


14
15
16
# File 'lib/hangar.rb', line 14

def self.do_not_delete
  Array.wrap(@@do_not_delete)
end

.route_namespaceObject


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/hangar.rb', line 18

def self.route_namespace
  if(@@route_namespace.present?)
    {
      module: 'hangar',
      path: @@route_namespace.to_s.pluralize,
      as: @@route_namespace.to_s.singularize
    }
    else
    { module: 'hangar' }
  end
end

.validate_environmentObject


30
31
32
# File 'lib/hangar.rb', line 30

def validate_environment
  Rails.env.test? or raise BadEnvironmentError, "Hangar should not be used in the #{Rails.env} environment"
end