Sha256: bf2a41bf4207bedd2910096e0b410d7882460818c1db10035fa02a166c9c2fd1

Contents?: true

Size: 782 Bytes

Versions: 37

Compression:

Stored size: 782 Bytes

Contents

module Inch
  module API
    # Gets all objects matching the given +object_names+
    class Get < Filter
      attr_reader :object

      def initialize(codebase, object_names)
        super(codebase, {})
        @objects = find_objects_with_names(object_names)
        @object = objects.first
      end

      private

      # Returns all objects matching the given +object_names+
      #
      # @param object_names [Array<String>]
      # @return [Array<CodeObject::Proxy::Base>]
      def find_objects_with_names(object_names)
        object_names.map do |object_name|
          if object = codebase.objects.find(object_name)
            object
          else
            codebase.objects.starting_with(object_name)
          end
        end.flatten
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
inch-0.4.7 lib/inch/api/get.rb
inch-0.5.0.rc3 lib/inch/api/get.rb
inch-0.5.0.rc2 lib/inch/api/get.rb
inch-0.5.0.rc1 lib/inch/api/get.rb
inch-0.4.6 lib/inch/api/get.rb
inch-0.4.5 lib/inch/api/get.rb
inch-0.4.4 lib/inch/api/get.rb
inch-0.4.4.rc4 lib/inch/api/get.rb
inch-0.4.4.rc3 lib/inch/api/get.rb
inch-0.4.4.rc2 lib/inch/api/get.rb
inch-0.4.4.rc1 lib/inch/api/get.rb
inch-0.4.3 lib/inch/api/get.rb
inch-0.4.3.rc2 lib/inch/api/get.rb
inch-0.4.3.rc1 lib/inch/api/get.rb
inch-0.4.2 lib/inch/api/get.rb
inch-0.4.1 lib/inch/api/get.rb
inch-0.4.0 lib/inch/api/get.rb
inch-0.4.0.rc3 lib/inch/api/get.rb
inch-0.4.0.rc2 lib/inch/api/get.rb
inch-0.4.0.rc1 lib/inch/api/get.rb