Class: ComponentCode

Inherits:
Object show all
Defined in:
lib/volt/server/rack/component_code.rb

Overview

Takes in the name and all component paths and has a .code method that returns all of the ruby setup code for the component.

Instance Method Summary collapse

Constructor Details

#initialize(component_name, component_paths, client = true) ⇒ ComponentCode

Returns a new instance of ComponentCode.



8
9
10
11
12
# File 'lib/volt/server/rack/component_code.rb', line 8

def initialize(component_name, component_paths, client=true)
  @component_name = component_name
  @component_paths = component_paths
  @client = client
end

Instance Method Details

#codeObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/volt/server/rack/component_code.rb', line 14

def code
  code = ''

  asset_files = AssetFiles.new(@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

  return code
end