Class: Zui::SourceBundle
- Inherits:
-
Object
- Object
- Zui::SourceBundle
- Defined in:
- lib/zui/source_bundle.rb
Constant Summary collapse
- REQUIRE_RELATIVE =
/\A\s*require_relative\s*(?:\(\s*)?["']([^"']+)["']\s*\)?\s*(?:#.*)?\z/
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(entrypoint, root: File.dirname(entrypoint), embedded_frameworks: ["zui"]) ⇒ SourceBundle
constructor
A new instance of SourceBundle.
Constructor Details
#initialize(entrypoint, root: File.dirname(entrypoint), embedded_frameworks: ["zui"]) ⇒ SourceBundle
Returns a new instance of SourceBundle.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/zui/source_bundle.rb', line 7 def initialize(entrypoint, root: File.dirname(entrypoint), embedded_frameworks: ["zui"]) @entrypoint = File.(entrypoint) @root = File.(root) frameworks = Array().map(&:to_s) raise ArgumentError, "embedded framework names cannot be empty" if frameworks.any?(&:empty?) names = frameworks.map { |name| Regexp.escape(name) }.join("|") @embedded_framework_require = /\A\s*require\s*(?:\(\s*)?["'](?:#{names})["']\s*\)?\s*(?:#.*)?\z/ @loaded = {} @loading = [] end |
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'lib/zui/source_bundle.rb', line 19 def call (@entrypoint) end |