Class: Planet
- Inherits:
-
Object
- Object
- Planet
- Defined in:
- lib/planet.rb,
lib/planet/blog.rb,
lib/planet/version.rb,
lib/planet/parsers/base_parser.rb
Defined Under Namespace
Modules: Version Classes: Blog, Importer, Parsers, Post
Constant Summary collapse
Instance Attribute Summary collapse
-
#blogs ⇒ Object
Returns the value of attribute blogs.
-
#config ⇒ Object
Returns the value of attribute config.
-
#whitelisted_tags ⇒ Object
Returns the value of attribute whitelisted_tags.
Instance Method Summary collapse
- #aggregate ⇒ Object
-
#initialize(config_file_path) ⇒ Planet
constructor
A new instance of Planet.
- #posts ⇒ Object
- #write_posts ⇒ Object
Constructor Details
#initialize(config_file_path) ⇒ Planet
Returns a new instance of Planet.
10 11 12 13 14 15 |
# File 'lib/planet.rb', line 10 def initialize(config_file_path) config_file = read_config_file(config_file_path) self.config = config_file[:planet] self.blogs = config_file[:blogs] self. = self.config['whitelisted_tags'] end |
Instance Attribute Details
#blogs ⇒ Object
Returns the value of attribute blogs.
8 9 10 |
# File 'lib/planet.rb', line 8 def blogs @blogs end |
#config ⇒ Object
Returns the value of attribute config.
8 9 10 |
# File 'lib/planet.rb', line 8 def config @config end |
#whitelisted_tags ⇒ Object
Returns the value of attribute whitelisted_tags.
8 9 10 |
# File 'lib/planet.rb', line 8 def @whitelisted_tags end |
Instance Method Details
#aggregate ⇒ Object
21 22 23 24 25 26 |
# File 'lib/planet.rb', line 21 def aggregate self.blogs.each do |blog| puts "=> Parsing #{ blog.feed }" blog.fetch end end |
#posts ⇒ Object
17 18 19 |
# File 'lib/planet.rb', line 17 def posts self.blogs.map { |b| b.posts }.flatten end |