Ruby Conditional argument to method
问题 I have some 'generic' methods that extract data based on css selectors that usually are the same in many websites. However I have another method that accept as argument the css selector for a given website. I need to call the get_title method if title_selector argument is nos passed. How can I do that? Scrape that accept css selectors as arguments def scrape(urls, item_selector, title_selector, price_selector, image_selector) collection = [] urls.each do |url| doc = Nokogiri::HTML(open(url)