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.12.6 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.12.4 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.12.3 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.12.2 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.12.1 vendor/pdoc/lib/pdoc/models/entity.rb
pdoc-0.2.0 lib/pdoc/models/entity.rb
distil-0.12.0 vendor/pdoc/lib/pdoc/models/entity.rb
distil-0.11.8 vendor/pdoc/lib/pdoc/models/entity.rb