lib/lookbook/services/list_resolver.rb
module Lookbook class ListResolver < Service attr_reader :item_set def initialize(to_include = nil, item_set = nil) @to_include = to_include @item_set = Array(item_set).compact.uniq.map(&:to_s) end def call(&resolver) included = to_include.inject([]) do |result, name| if name == "*" result += item_set.select { |item| !result.include?(item) } elsif item_set.include?(name) result << name end result end resolved = resolver ? included.map { |item| resolver.call(item) } : included resolved.compact end def to_include case @to_include when true ["*"] when false [] else Array(@to_include).compact.uniq.map(&:to_s) end end end end
Source Files
- app/components/lookbook/base_component.rb
- app/components/lookbook/button/component.rb
- app/components/lookbook/button_group/component.rb
- app/components/lookbook/code/component.rb
- app/components/lookbook/copy_button/component.rb
- app/components/lookbook/debug_menu/component.rb
- app/components/lookbook/dimensions_display/component.rb
- app/components/lookbook/display_options/editor/component.rb
- app/components/lookbook/display_options/field/component.rb
- app/components/lookbook/embed/component.rb
- app/components/lookbook/embed/inspector/component.rb
- app/components/lookbook/embed_code_dropdown/component.rb
- app/components/lookbook/file_source/component.rb
- app/components/lookbook/filter/component.rb
- app/components/lookbook/header/component.rb
- app/components/lookbook/icon/component.rb
- app/components/lookbook/icon_button/component.rb
- app/components/lookbook/inspector_panel/component.rb
- app/components/lookbook/logo/component.rb
- app/components/lookbook/message/component.rb
- app/components/lookbook/nav/component.rb
- app/components/lookbook/nav/directory/component.rb
- app/components/lookbook/nav/entity/component.rb
- app/components/lookbook/nav/item/component.rb
- app/components/lookbook/page_tabs/component.rb
- app/components/lookbook/params/editor/component.rb
- app/components/lookbook/params/field/component.rb
- app/components/lookbook/prose/component.rb
- app/components/lookbook/split_layout/component.rb
- app/components/lookbook/tab_panels/component.rb
- app/components/lookbook/tab_panels/panel/component.rb
- app/components/lookbook/tabs/component.rb
- app/components/lookbook/tabs/dropdown_tab/component.rb
- app/components/lookbook/tabs/tab/component.rb
- app/components/lookbook/tag_component.rb
- app/components/lookbook/text_button/component.rb
- app/components/lookbook/toolbar/component.rb
- app/components/lookbook/viewport/component.rb
- app/controllers/concerns/lookbook/targetable_concern.rb
- app/controllers/concerns/lookbook/with_panels_concern.rb
- app/controllers/concerns/lookbook/with_preview_controller_concern.rb
- app/controllers/lookbook/application_controller.rb
- app/controllers/lookbook/embeds_controller.rb
- app/controllers/lookbook/inspector_controller.rb
- app/controllers/lookbook/page_controller.rb
- app/controllers/lookbook/pages_controller.rb
- app/controllers/lookbook/preview_controller.rb
- app/controllers/lookbook/previews_controller.rb
- app/helpers/lookbook/application_helper.rb
- lib/lookbook.rb
- lib/lookbook/cable/cable.rb
- lib/lookbook/cable/connection.rb
- lib/lookbook/cable/reload_channel.rb
- lib/lookbook/engine.rb
- lib/lookbook/entities/collections/concerns/hierarchical_collection.rb
- lib/lookbook/entities/collections/entity_collection.rb
- lib/lookbook/entities/collections/page_collection.rb
- lib/lookbook/entities/collections/preview_collection.rb
- lib/lookbook/entities/collections/render_target_collection.rb
- lib/lookbook/entities/collections/scenario_collection.rb
- lib/lookbook/entities/concerns/annotatable_entity.rb
- lib/lookbook/entities/concerns/inspectable_entity.rb
- lib/lookbook/entities/concerns/locatable_entity.rb
- lib/lookbook/entities/concerns/navigable_entity.rb
- lib/lookbook/entities/entity.rb
- lib/lookbook/entities/page_entity.rb
- lib/lookbook/entities/page_section_entity.rb
- lib/lookbook/entities/preview_entity.rb
- lib/lookbook/entities/renderable_entity.rb
- lib/lookbook/entities/rendered_scenario_entity.rb
- lib/lookbook/entities/scenario_entity.rb
- lib/lookbook/entities/scenario_group_entity.rb
- lib/lookbook/file_watcher.rb
- lib/lookbook/helpers/class_names_helper.rb
- lib/lookbook/helpers/page_helper.rb
- lib/lookbook/helpers/preview_helper.rb
- lib/lookbook/helpers/ui_elements_helper.rb
- lib/lookbook/lang.rb
- lib/lookbook/param.rb
- lib/lookbook/preview.rb
- lib/lookbook/preview_after_render.rb
- lib/lookbook/preview_controller_actions.rb
- lib/lookbook/preview_parser.rb
- lib/lookbook/reloaders.rb
- lib/lookbook/runtime_context.rb
- lib/lookbook/services/code/code_beautifier.rb
- lib/lookbook/services/code/code_highlighter.rb
- lib/lookbook/services/code/code_indenter.rb
- lib/lookbook/services/config_loader.rb
- lib/lookbook/services/data/parsers/data_parser.rb
- lib/lookbook/services/data/parsers/json_parser.rb
- lib/lookbook/services/data/parsers/yaml_parser.rb
- lib/lookbook/services/data/resolvers/data_resolver.rb
- lib/lookbook/services/data/resolvers/eval_resolver.rb
- lib/lookbook/services/data/resolvers/file_resolver.rb
- lib/lookbook/services/data/resolvers/method_resolver.rb
- lib/lookbook/services/data/resolvers/yaml_resolver.rb
- lib/lookbook/services/entities/page_tree_builder.rb
- lib/lookbook/services/entities/preview_tree_builder.rb
- lib/lookbook/services/list_resolver.rb
- lib/lookbook/services/markdown_renderer.rb
- lib/lookbook/services/priority_prefix_parser.rb
- lib/lookbook/services/string_value_caster.rb
- lib/lookbook/services/tags/key_value_tag_parser.rb
- lib/lookbook/services/tags/tag_options_parser.rb
- lib/lookbook/services/templates/action_view_annotations_handler.rb
- lib/lookbook/services/templates/action_view_annotations_stripper.rb
- lib/lookbook/services/templates/frontmatter_extractor.rb
- lib/lookbook/services/templates/styles_extractor.rb
- lib/lookbook/services/urls/data_uri_encoder.rb
- lib/lookbook/services/urls/file_data_uri_encoder.rb
- lib/lookbook/services/urls/search_param_encoder.rb
- lib/lookbook/services/urls/search_param_parser.rb
- lib/lookbook/stores/config_store.rb
- lib/lookbook/stores/hook_store.rb
- lib/lookbook/stores/input_store.rb
- lib/lookbook/stores/panel_store.rb
- lib/lookbook/stores/tag_store.rb
- lib/lookbook/support/deprecation.rb
- lib/lookbook/support/errors/config_error.rb
- lib/lookbook/support/errors/error.rb
- lib/lookbook/support/errors/parser_error.rb
- lib/lookbook/support/errors/preview_template_error.rb
- lib/lookbook/support/errors/routing_error.rb
- lib/lookbook/support/errors/template_error.rb
- lib/lookbook/support/evented_file_update_checker.rb
- lib/lookbook/support/null_object.rb
- lib/lookbook/support/null_websocket.rb
- lib/lookbook/support/service.rb
- lib/lookbook/support/store.rb
- lib/lookbook/support/tree_node.rb
- lib/lookbook/support/utils/path_utils.rb
- lib/lookbook/support/utils/utils.rb
- lib/lookbook/support/utils/where.rb
- lib/lookbook/tags/after_render_tag.rb
- lib/lookbook/tags/custom_tag.rb
- lib/lookbook/tags/display_tag.rb
- lib/lookbook/tags/hidden_tag.rb
- lib/lookbook/tags/id_tag.rb
- lib/lookbook/tags/label_tag.rb
- lib/lookbook/tags/logical_path_tag.rb
- lib/lookbook/tags/param_tag.rb
- lib/lookbook/tags/priority_tag.rb
- lib/lookbook/tags/renders_tag.rb
- lib/lookbook/tags/source_tag.rb
- lib/lookbook/tags/tag_provider.rb
- lib/lookbook/tags/type_tag.rb
- lib/lookbook/tags/yard_tag.rb
- lib/lookbook/theme.rb
- lib/lookbook/version.rb
- lib/lookbook/websocket.rb