Class: ViewComponent::Storybook::Collections::StoriesCollection
- Inherits:
-
Object
- Object
- ViewComponent::Storybook::Collections::StoriesCollection
- Includes:
- Enumerable
- Defined in:
- lib/view_component/storybook/collections/stories_collection.rb
Instance Attribute Summary collapse
-
#stories ⇒ Object
readonly
Returns the value of attribute stories.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#stories ⇒ Object (readonly)
Returns the value of attribute stories.
11 12 13 |
# File 'lib/view_component/storybook/collections/stories_collection.rb', line 11 def stories @stories end |
Class Method Details
.stories_class?(klass) ⇒ Boolean
23 24 25 26 27 |
# File 'lib/view_component/storybook/collections/stories_collection.rb', line 23 def self.stories_class?(klass) return unless klass.ancestors.include?(ViewComponent::Storybook::Stories) !klass.respond_to?(:abstract_class) || klass.abstract_class != true end |
.stories_from_code_object(code_object) ⇒ Object
17 18 19 20 21 |
# File 'lib/view_component/storybook/collections/stories_collection.rb', line 17 def self.stories_from_code_object(code_object) klass = code_object.path.constantize klass.code_object = code_object klass end |
Instance Method Details
#load(code_objects) ⇒ Object
13 14 15 |
# File 'lib/view_component/storybook/collections/stories_collection.rb', line 13 def load(code_objects) @stories = Array(code_objects).map { |obj| StoriesCollection.stories_from_code_object(obj) }.compact end |