module Jok require "httparty" require "nokogiri" require "jok/joke_factory" class << self extend ::Forwardable delegate [:list, :method_list] => :feed def feed @feed ||= JokeFactory.new end end method_list.each do |method| define_singleton_method method do feeds = feed.send(method) feeds[ srand % feeds.length] end end end