Sha256: e994e154c9b0722b34a9be4381460bcf1ef35a114c8fc2734795ddea3412da4b

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

module Jsdoc
  class Function < ActiveRecord::Base
    belongs_to :symbol
    has_many :params, :dependent => :destroy
    has_many :returns, :dependent => :destroy
    has_many :requires, :dependent => :destroy
    has_many :throws, :dependent => :destroy
    has_many :sees, :as => 'see_for', :dependent => :destroy
    has_many :examples, :as => 'example_for', :dependent => :destroy

    has_many :borrowed_to_join, :class_name => 'Jsdoc::BorrowedFunction', :dependent => :destroy
    has_many :borrowed_to, :through => :borrowed_to_join, :dependent => :destroy

    scope :private, where(:is_private => true)
    scope :public, where(:is_private => false)
    scope :method_types, where(:function_type => 'method')
    scope :event_types, where(:function_type => 'event')

    scope :for_symbol, lambda { |s| includes(:borrowed_to).where('symbol_id = :symbol_id OR (jsdoc_borrowed_functions.borrowed_to_id = :symbol_id)', :symbol_id => s.id) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsdoc-rails-0.1 app/models/jsdoc/function.rb