Module: WarclightHelper
- Defined in:
- app/helpers/warclight_helper.rb
Overview
Generic Helpers used in Warclight
Instance Method Summary collapse
Instance Method Details
#return_five(options = {}) ⇒ Object
21 22 23 |
# File 'app/helpers/warclight_helper.rb', line 21 def return_five( = {}) [:value][0, 5].join('; ') + '...' end |
#url_to_link(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/warclight_helper.rb', line 6 def url_to_link( = {}) safe_join([:value].map do |url| begin res = Net::HTTP.get_response(URI(url)) if res.code.start_with?('1', '2', '3') link_to(url, url, target: '_blank') << ' 🔗' else url + ' (Not available)' end rescue url + ' (Not available)' end end, '') end |