Sha256: f8f8c4ccfed488ea8e4c3981b70fdb2232e2020388327fffd20bdc5e340655e4

Contents?: true

Size: 678 Bytes

Versions: 2

Compression:

Stored size: 678 Bytes

Contents

module PowerStencil
  module Project

    module Completion

      def query_for_completion(query_type)
        case query_type
        when :entities
          engine.entities(engine.root_universe).map(&:as_path).sort
        when :'entity-types'
          engine.available_entity_types.sort
        when :scenario
          engine.entities(engine.root_universe, criterion: :by_type, value: :entity_override) do |entity|
            !entity.scenario.nil? and !entity.scenario.empty?
          end.map(&:scenario).sort.uniq
        else
          raise PowerStencil::Error, "'#{query_type}' is not a valid query type for completion !"
        end
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
power_stencil-0.8.1 lib/power_stencil/project/completion.rb
power_stencil-0.8.0 lib/power_stencil/project/completion.rb