I am confused with the following code snippet.
The HTTParty library has a class method named def self.get(..).
I include it in the module Client, and then include this module Clientin my class Lineand refer to the method getin my method def self.hi(). But when I run, it throws an error:
ruby geek-module.rb
geek-module.rb:12:in `hi': undefined method `get' for Line:Class (NoMethodError)
from geek-module.rb:16:in `<main>'
Why can't I access this method getfor HTTParty? Below is the code:
require 'rubygems'
require 'httparty'
module Client
include HTTParty
end
class Line
include Client
def self.hi
get("http://gogle.com")
end
end
puts Line.hi
source
share