Class: RubyLens::ReportAssetAssembler
- Inherits:
-
Object
- Object
- RubyLens::ReportAssetAssembler
- Defined in:
- lib/rubylens/report_asset_assembler.rb
Constant Summary collapse
- STYLES_PLACEHOLDER =
"{{REPORT_STYLES}}"- RUNTIME_PLACEHOLDER =
"{{REPORT_RUNTIME}}"
Instance Method Summary collapse
- #assemble ⇒ Object
-
#initialize(shell_path: File.expand_path("../../assets/shells/report.html", __dir__), stylesheet_path: File.expand_path("../../assets/styles/report.css", __dir__), runtime_path: File.expand_path("../../assets/runtime/report.js", __dir__)) ⇒ ReportAssetAssembler
constructor
A new instance of ReportAssetAssembler.
Constructor Details
#initialize(shell_path: File.expand_path("../../assets/shells/report.html", __dir__), stylesheet_path: File.expand_path("../../assets/styles/report.css", __dir__), runtime_path: File.expand_path("../../assets/runtime/report.js", __dir__)) ⇒ ReportAssetAssembler
Returns a new instance of ReportAssetAssembler.
10 11 12 13 14 15 16 17 18 |
# File 'lib/rubylens/report_asset_assembler.rb', line 10 def initialize( shell_path: File.("../../assets/shells/report.html", __dir__), stylesheet_path: File.("../../assets/styles/report.css", __dir__), runtime_path: File.("../../assets/runtime/report.js", __dir__) ) @shell_path = shell_path @stylesheet_path = stylesheet_path @runtime_path = runtime_path end |
Instance Method Details
#assemble ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/rubylens/report_asset_assembler.rb', line 20 def assemble shell = File.read(@shell_path) validate_placeholder(shell, STYLES_PLACEHOLDER) validate_placeholder(shell, RUNTIME_PLACEHOLDER) shell .sub(STYLES_PLACEHOLDER, File.read(@stylesheet_path)) .sub(RUNTIME_PLACEHOLDER, File.read(@runtime_path)) end |