Module: LocoMotion::Helpers

Defined in:
lib/loco_motion/helpers.rb

Class Method Summary collapse

Class Method Details

.component_example_path(component_name) ⇒ Object



99
100
101
# File 'lib/loco_motion/helpers.rb', line 99

def component_example_path(component_name)
  "/examples/#{component_name}"
end

.component_partial_path(component_name) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/loco_motion/helpers.rb', line 103

def component_partial_path(component_name)
  comp = COMPONENTS[component_name]

  comp_split = component_name.split("::")
  framework = comp_split.first.underscore
  section = comp_split.length == 3 ? comp_split[1] : nil
  example = comp[:example]
  section_path = section ? "#{section.underscore}/" : ""

  "/examples/#{framework}/#{section_path}#{example}"
end