2014-03-05 1 views

답변

4

클래스와 모듈은 당신이 new 방법을 통해 클래스를 초기화 그래서

module Urlfetch 
    class Fetch 

    def initialize(url) 
     @url = url 
     analyze! 
    end 

    #extra methods goes here 

    end 
end 

다음 대문자 이름으로 정의

response = Urlfetch::Fetch.new("http://google.com") 
puts response 
2

우선 해제, 모듈 및 클래스는 대문자로한다 undefined method fetch 같은 오류를 받고 있어요 . 둘째, 객체를 생성하려면 new이 필요합니다.

URLFetch::Fetch.new("http://google.com") 
루비
관련 문제