Skip to content

Instantly share code, notes, and snippets.

@canujohann
Last active August 29, 2015 14:03
Show Gist options
  • Save canujohann/c05fe959dd9a2ef19387 to your computer and use it in GitHub Desktop.
Save canujohann/c05fe959dd9a2ef19387 to your computer and use it in GitHub Desktop.
謎のエラー
class Settlement
    
    attr_reader :url, :parameters
    
    def initialize(&block)
      instance_eval block.call
    end
    
    #initialize用
    def parameters(x) ; @parameters = x; end
    def url(x) ; @url = x;  end

end

settlement = Settlement.new do
    url "https://xxxxx"
    parameters("ffff")
end

  これでエラーが発生します

NoMethodError - undefined method parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment