2010-02-03 2 views
1

레일에서 class_inheritable_reader가 문서화 된 곳을 찾아 내려고 노력하고 있습니다. 구글 검색의 존재를 공개하고, 보석 자체에보고하는 것은 나중에 방법을 찾을 수 ActiveSupport의 class_inheritable_reader가 문서화되지 않은 이유는 무엇입니까?

:

def class_inheritable_reader(*syms) 
    syms.each do |sym| 
    next if sym.is_a?(Hash) 
    class_eval <<-EOS 
     def self.#{sym}      # def self.before_add_for_comments 
     read_inheritable_attribute(:#{sym}) #   read_inheritable_attribute(:before_add_for_comments) 
     end         # end 
              # 
     def #{sym}        # def before_add_for_comments 
     self.class.#{sym}     # self.class.before_add_for_comments 
     end         # end 
    EOS 
    end 
end 
.... 

그러나 모두 ActiveSupport과의 rdocs보고 '레이크 문서 : 레일'당신이 찾을 수 없음 문서화 ... 어째서?

답변

1

, 당신은 탐색 할 수 있습니다 여기서 클래스는 실제로 구현됩니다. 또한 GitHub의 레일 레포지토리에서 latest version of the file을 볼 수 있습니다.

해당 파일에는 아래의 클래스 수준의 설명서가 있지만 메소드 수준의 설명서는 없으므로 아무 것도 찾을 수 없습니다.

# Allows attributes to be shared within an inheritance hierarchy, but where each descendant gets a copy of 
# their parents' attributes, instead of just a pointer to the same. This means that the child can add elements 
# to, for example, an array without those additions being shared with either their parent, siblings, or 
# children, which is unlike the regular class-level attributes that are shared across the entire hierarchy. 
0

I found it on APIdock. 그것은 클래스의 확장 인 것처럼 보입니다. 설명서가 없지만 구현을 볼 수 있습니다./inheritable_attributes.rb

것은 볼

activesupport/lib 디렉토리/active_support/core_ext/클래스 :

당신이 보석이 컴퓨터에 설치되어있는 폴더를 열면
+0

안녕하세요. TomToday ... 감사합니다. 불행하게도 Google이 Google을 검색했을 때 정확히 내가 방문한 사이트입니다. 나는 더 많은 공식 문서를 원했다. 당분간 만족스러운 답변을 찾았 기 때문에 좀 더 자세하게 질문하고 '보너스'질문을 업데이트하겠습니다. – btelles

관련 문제