lib/lookbook/preview_example.rb in lookbook-1.1.1 vs lib/lookbook/preview_example.rb in lookbook-1.2.0

- old
+ new

@@ -20,12 +20,12 @@ def label @example_inspector.label.presence || name.titleize end - def display_params - @preview.display_params.merge(@example_inspector.display_params) + def display_options + @preview.display_options.merge(@example_inspector.display_options) end def method_source @example_inspector.source.sub(/^def \w+\s?(\([^)]+\))?/m, "").split("\n")[0..-2].join("\n").strip_heredoc.strip end @@ -61,14 +61,18 @@ path.sub(/\..*$/, "") end def full_template_path(template_path) template_path = strip_ext template_path - base_path = Array(Lookbook.config.preview_paths).detect do |p| + base_path = preview_paths.detect do |p| Dir["#{p}/#{template_path}.html.*"].first end path = Dir["#{base_path}/#{template_path}.html.*"].first path ? Pathname.new(path) : nil + end + + def preview_paths + PathUtils.normalize_all(Lookbook.config.preview_paths) end class << self def all Preview.all.map { |preview| preview.examples }.flatten