Class: Miteru::Feeds::Base
Constant Summary
collapse
- IGNORE_EXTENSIONS =
%w[.htm .html .php .asp .aspx .exe .txt].freeze
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Service
call, #result, result
Constructor Details
#initialize(base_url) ⇒ Base
Returns a new instance of Base.
17
18
19
20
21
22
|
# File 'lib/miteru/feeds/base.rb', line 17
def initialize(base_url)
super()
@base_url = base_url
@headers = {}
end
|
Instance Attribute Details
#base_url ⇒ String
9
10
11
|
# File 'lib/miteru/feeds/base.rb', line 9
def base_url
@base_url
end
|
12
13
14
|
# File 'lib/miteru/feeds/base.rb', line 12
def
@headers
end
|
Class Method Details
.inherited(child) ⇒ Object
54
55
56
57
|
# File 'lib/miteru/feeds/base.rb', line 54
def inherited(child)
super
Miteru.feeds << child
end
|
Instance Method Details
49
50
51
|
# File 'lib/miteru/feeds/base.rb', line 49
def call
decomposed_urls.map { |url| Website.new(url, source:) }
end
|
#decomposed_urls ⇒ Array<String>
42
43
44
|
# File 'lib/miteru/feeds/base.rb', line 42
def decomposed_urls
urls.uniq.select { |url| url.start_with?("http://", "https://") }.map { |url| decompose(url) }.flatten.uniq
end
|
#source ⇒ Object
24
25
26
|
# File 'lib/miteru/feeds/base.rb', line 24
def source
@source ||= self.class.to_s.split("::").last
end
|
#urls ⇒ Array<String>
33
34
35
|
# File 'lib/miteru/feeds/base.rb', line 33
def urls
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
|