Sha256: 1076dda913ab63186a301ed5e28c1085c2e26dfaa5a5ebafe4a54156d4903a40
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require 'volt/server/html_parser/view_parser' require 'volt/server/component_templates' require 'volt/server/rack/asset_files' # Takes in the name and all component paths and has a .code # method that returns all of the ruby setup code for the component. module Volt class ComponentCode def initialize(volt_app, component_name, component_paths, client = true) @volt_app = volt_app @component_name = component_name @component_paths = component_paths @client = client end # The client argument is for if this code is being generated for the client def code # Start with config code code = @client ? generate_config_code : '' asset_files = AssetFiles.from_cache(@volt_app.app_url, @component_name, @component_paths) asset_files.component_paths.each do |component_path, component_name| code << ComponentTemplates.new(component_path, component_name, @client).code code << "\n\n" end code end def generate_config_code # Setup Volt.config on the client "\nVolt.setup_client_config(#{Volt.config.public.to_h.inspect})\n" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
volt-0.9.5.pre9 | lib/volt/server/rack/component_code.rb |
volt-0.9.5.pre8 | lib/volt/server/rack/component_code.rb |