Class: Belt::Holster

Inherits:
Object
  • Object
show all
Defined in:
lib/belt/holster.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.controllers_pathObject

Defaults follow Belt project structure conventions



19
20
21
# File 'lib/belt/holster.rb', line 19

def controllers_path
  @controllers_path || File.join(gem_root, 'lambda', 'controllers')
end

.gem_rootObject

Convention: gem root is two levels up from the holster file



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

def gem_root
  @gem_root ||= File.expand_path('../..', caller_locations(1, 1).first.path)
end

.models_pathObject



23
24
25
# File 'lib/belt/holster.rb', line 23

def models_path
  @models_path || File.join(gem_root, 'lambda', 'models')
end

.routes_pathObject



27
28
29
# File 'lib/belt/holster.rb', line 27

def routes_path
  @routes_path || File.join(gem_root, 'infrastructure', 'routes.tf.rb')
end

.schema_pathObject



31
32
33
# File 'lib/belt/holster.rb', line 31

def schema_path
  @schema_path || File.join(gem_root, 'infrastructure', 'schema.tf.rb')
end

Class Method Details

.holster_nameObject



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

def holster_name
  name&.split('::')&.first&.downcase || 'unknown'
end

.inherited(subclass) ⇒ Object



6
7
8
9
# File 'lib/belt/holster.rb', line 6

def inherited(subclass)
  super
  Belt.holsters << subclass
end