Class: ConsadoleAggregator::News::SiteBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/consadole_aggregator/news.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ SiteBuilder

Returns a new instance of SiteBuilder.



29
30
31
# File 'lib/consadole_aggregator/news.rb', line 29

def initialize name
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/consadole_aggregator/news.rb', line 27

def name
  @name
end

Instance Method Details

#buildObject



38
39
40
41
42
43
44
45
# File 'lib/consadole_aggregator/news.rb', line 38

def build
  site = Site.new @name
  site.resource = @resource if @resource
  site.list_parser = @parse_list if @parse_list
  site.article_filter = @filter_article if @filter_article
  site.article_parser = @parse_article if @parse_article
  site
end

#filter_article(&block) ⇒ Object



35
# File 'lib/consadole_aggregator/news.rb', line 35

def filter_article █ @filter_article = block; end

#parse_article(&block) ⇒ Object



36
# File 'lib/consadole_aggregator/news.rb', line 36

def parse_article █ @parse_article = block; end

#parse_list(&block) ⇒ Object



34
# File 'lib/consadole_aggregator/news.rb', line 34

def parse_list █ @parse_list = block; end

#resource(&block) ⇒ Object



33
# File 'lib/consadole_aggregator/news.rb', line 33

def resource █ @resource = block; end