lib/lookbook/preview.rb in lookbook-0.2.0 vs lib/lookbook/preview.rb in lookbook-0.2.1

- old
+ new

@@ -15,10 +15,12 @@ lookbook_examples.find { |m| m.name == example_name } end def lookbook_examples return @lookbook_examples if @lookbook_examples.present? - examples = code_object.meths.map { |m| PreviewExample.new(m.name.to_s, self) } + public_methods = public_instance_methods(false) + public_method_objects = code_object.meths.filter { |m| public_methods.include?(m.name) } + examples = public_method_objects.map { |m| PreviewExample.new(m.name.to_s, self) } examples.reject!(&:hidden?) @lookbook_examples ||= Lookbook.config.sort_examples ? examples.sort_by(&:label) : examples end # Examples::FooBarComponentPreview -> "Examples::FooBar"