Sha256: b2cbc2afa7a951bc0e43b3822e8f5fea6af874a915e281edf92f4e920a998065

Contents?: true

Size: 778 Bytes

Versions: 36

Compression:

Stored size: 778 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>]
      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

36 entries across 36 versions & 1 rubygems

Version Path
inch-0.9.0.rc1 lib/inch/api/get.rb
inch-0.8.0 lib/inch/api/get.rb
inch-0.8.0.rc2 lib/inch/api/get.rb
inch-0.8.0.rc1 lib/inch/api/get.rb
inch-0.7.1 lib/inch/api/get.rb
inch-0.7.0 lib/inch/api/get.rb
inch-0.6.4 lib/inch/api/get.rb
inch-0.6.3 lib/inch/api/get.rb
inch-0.6.2 lib/inch/api/get.rb
inch-0.6.1 lib/inch/api/get.rb
inch-0.6.0 lib/inch/api/get.rb
inch-0.6.0.rc6 lib/inch/api/get.rb
inch-0.6.0.rc5 lib/inch/api/get.rb
inch-0.6.0.rc4 lib/inch/api/get.rb
inch-0.6.0.rc3 lib/inch/api/get.rb
inch-0.6.0.rc2 lib/inch/api/get.rb
inch-0.6.0.rc1 lib/inch/api/get.rb
inch-0.5.10 lib/inch/api/get.rb
inch-0.5.9 lib/inch/api/get.rb
inch-0.5.8 lib/inch/api/get.rb