Skip to content

Commit a51145d

Browse files
committed
Merge pull request #68 from id774/issue66
#66 Improvement plugin Subscription::Text
2 parents 51f0c46 + e9dd237 commit a51145d

1 file changed

Lines changed: 19 additions & 26 deletions

File tree

plugins/subscription/text.rb

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
# -*- coding: utf-8 -*-
22
# Name:: Automatic::Plugin::Subscription::Text
33
# Author:: soramugi <http://soramugi.net>
4-
# Created:: May 6, 2013
5-
# Updated:: May 6, 2013
6-
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
4+
# 774 <http://id774.net>
5+
# Created:: May 6, 2013
6+
# Updated:: Feb 19, 2014
7+
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
78
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
89

910
module Automatic::Plugin
1011
class TextFeed
11-
def initialize
12-
@link = 'http://dummy'
13-
@title = 'dummy'
14-
end
15-
16-
def link
17-
@link
18-
end
19-
20-
def title
21-
@title
22-
end
12+
attr_accessor :title, :link, :description, :author, :comments
2313

24-
def set_link(link)
25-
@link = link
26-
end
27-
28-
def set_title(title)
29-
@title = title
14+
def initialize
15+
@link = 'http://dummy'
16+
@title = 'dummy'
17+
@description = ''
18+
@author = ''
19+
@comments = ''
3020
end
3121
end
3222

@@ -41,29 +31,32 @@ def initialize(config, pipeline=[])
4131
unless @config['titles'].nil?
4232
@config['titles'].each {|title|
4333
textFeed = TextFeed.new
44-
textFeed.set_title(title)
34+
textFeed.title = title
4535
@dummyfeeds << textFeed
4636
}
4737
end
4838

4939
unless @config['urls'].nil?
5040
@config['urls'].each {|url|
5141
textFeed = TextFeed.new
52-
textFeed.set_link(url)
42+
textFeed.link = url
5343
@dummyfeeds << textFeed
5444
}
5545
end
5646

5747
unless @config['feeds'].nil?
5848
@config['feeds'].each {|feed|
5949
textFeed = TextFeed.new
60-
textFeed.set_title(feed['title']) unless feed['title'].nil?
61-
textFeed.set_link(feed['url']) unless feed['url'].nil?
50+
textFeed.title = feed['title'] unless feed['title'].nil?
51+
textFeed.link = feed['url'] unless feed['url'].nil?
52+
textFeed.description = feed['description'] unless feed['description'].nil?
53+
textFeed.author = feed['author'] unless feed['author'].nil?
54+
textFeed.comments = feed['comments'] unless feed['comments'].nil?
6255
@dummyfeeds << textFeed
6356
}
6457
end
65-
end
6658

59+
end
6760
end
6861

6962
def run

0 commit comments

Comments
 (0)