Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/textminer/link_methods_hash.rb,
lib/textminer/link_methods_hash.rb,
lib/textminer/link_methods_hash.rb,
lib/textminer/link_methods_hash.rb

Overview

Hash methods

Instance Method Summary (collapse)

Instance Method Details



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/textminer/link_methods_hash.rb', line 3

def links(just_urls = true)
  if self['message']['items'].nil?
    tmp = self['message']['link']
    if tmp.nil?
      tmp = nil
    else
      tmp = tmp.reject { |c| c.empty? }
    end
  else
    tmp = self['message']['items'].collect { |x| x['link'] }.reject { |c| c.empty? }
  end

	return parse_links(tmp, just_urls)
end


26
27
28
# File 'lib/textminer/link_methods_hash.rb', line 26

def links_pdf(just_urls = true)
	return parse_links(pull_links(self, '^application\/pdf$'), just_urls)
end


32
33
34
# File 'lib/textminer/link_methods_hash.rb', line 32

def links_plain(just_urls = true)
	return parse_links(pull_links(self, '^application\/plain$|^text\/plain$'), just_urls)
end


20
21
22
# File 'lib/textminer/link_methods_hash.rb', line 20

def links_xml(just_urls = true)
	return parse_links(pull_links(self, '^application\/xml$|^text\/xml$'), just_urls)
end