Created
December 17, 2013 11:22
-
-
Save st63jun/8003464 to your computer and use it in GitHub Desktop.
Automatic::Plugin::FIlter::Format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Name:: Automatic::Plugin::Filter::Format | |
# Author:: Jun Saito <https://github.com/st63jun> | |
# Created:: Dec 17, 2013 | |
# Updated:: Dec 17, 2013 | |
# Copyright:: Copyright (c) 2013 Jun Saito. | |
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. | |
module Automatic::Plugin | |
class FilterFormat | |
require 'erb' | |
def initialize(config, pipeline=[]) | |
@config = config | |
@pipeline = pipeline | |
@template = ERB.new(@config['format']) | |
end | |
def run | |
@return_feeds = [] | |
@pipeline.each {|feeds| | |
unless feeds.nil? | |
feeds.items.each {|feed| | |
feed.send(@config['target'] + '=', @template.result(binding)) | |
} | |
@return_feeds << feeds | |
end | |
} | |
@return_feeds | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment