Module: Lennarb::Plugins::Mount::ClassMethods
- Defined in:
- lib/lennarb/plugins/mount.rb
Instance Method Summary collapse
Instance Method Details
#mount(app_class, at:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lennarb/plugins/mount.rb', line 13 def mount(app_class, at:) raise ArgumentError, 'Expected a Lennarb class' unless app_class.is_a?(Class) && app_class <= Lennarb raise ArgumentError, 'Mount path must start with /' unless at.start_with?('/') @_mounted_apps ||= {} normalized_path = normalize_mount_path(at) mounted_app = app_class.new mounted_app.freeze! @_mounted_apps[normalized_path] = mounted_app end |