Class: Ruflet::Rails::Protocol::MobileLoader
- Inherits:
-
Object
- Object
- Ruflet::Rails::Protocol::MobileLoader
- Defined in:
- lib/ruflet/rails/protocol/mobile_loader.rb
Instance Method Summary collapse
-
#initialize(file_path) ⇒ MobileLoader
constructor
A new instance of MobileLoader.
- #load! ⇒ Object
Constructor Details
#initialize(file_path) ⇒ MobileLoader
Returns a new instance of MobileLoader.
7 8 9 |
# File 'lib/ruflet/rails/protocol/mobile_loader.rb', line 7 def initialize(file_path) @file_path = file_path end |
Instance Method Details
#load! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ruflet/rails/protocol/mobile_loader.rb', line 11 def load! absolute = File.(@file_path) raise ArgumentError, "Mobile file not found: #{absolute}" unless File.file?(absolute) captured_entrypoint = nil interceptor = lambda do |entrypoint:, **_kwargs| captured_entrypoint = entrypoint :captured end Ruflet.with_run_interceptor(interceptor) do Kernel.load(absolute) end raise ArgumentError, "No Ruflet app boot found in #{absolute}. Expected MyApp.new.run" unless captured_entrypoint { entrypoint: captured_entrypoint } end |