Sha256: db9205b0d21fc896c488300477bf1577e5db1c47e469c888066c2690e687d3ae

Contents?: true

Size: 1.03 KB

Versions: 28

Compression:

Stored size: 1.03 KB

Contents

module PDoc
  module Models
    class Entity < Base
      attr_accessor :alias
      
      def signatures
        @signatures ||= []
      end
      
      def <=>(other)
        id.downcase <=> other.id.downcase
      end
      
      def src_code_href
        proc = Models.src_code_href
        @src_code_href ||= proc ? proc.call(self) : nil
      end

      def signatures?
        @signatures && !@signatures.empty?
      end
      
      def signature
        @signature ||= signatures.first
      end
      
      def methodized?
        !!@methodized
      end
      
      def alias?
        !!@alias
      end
      
      # returns an array of aliases
      def aliases
        @aliases ||= []
      end
      
      def aliases?
        @aliases && !@aliases.empty?
      end
      
      def to_hash
        super.merge({
          :aliases => aliases.map { |a| a.id },
          :alias => self.alias ? self.alias.id : nil,
          :signatures => signatures,
          :src_code_href => src_code_href
        })
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
distil-0.14.4 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.3 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.2 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.2.a vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.1 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.1.a vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.0 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.0.i vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.0.h vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.0.g vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.0.d vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.0.c vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.14.0.b vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.13.6 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.13.5 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.13.4 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.13.3 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.13.2 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.13.1 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.13.0 vendor/pdoc/lib/pdoc/models/entity.rb