Last active
September 27, 2018 12:50
-
-
Save astagi/cd4812cecf0c2f2d1b53d9b52fdf0f92 to your computer and use it in GitHub Desktop.
Dynamic generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Ansa | |
# .... | |
private | |
def self.generate_get_news(category, url) | |
define_singleton_method("get_#{category}_news") do | |
get_news_by_url(url) | |
end | |
end | |
public | |
LINKS.each do |category, url| | |
generate_get_news category, url | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment