Skip to content

Commit 6ceea6b

Browse files
committed
182 Refactoring
1 parent 00f7b2b commit 6ceea6b

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

lib/automatic/pipeline.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def self.load_plugin(module_name)
2020
subdir = File.basename dir
2121
if /#{subdir}_(.*)$/ =~ module_name.underscore
2222
path = dir + "/#{$1}.rb"
23-
return Automatic::Plugin.autoload module_name.to_sym, path.to_s if File.exists? path
23+
return Automatic::Plugin.autoload module_name.to_sym,
24+
path.to_s if File.exists? path
2425
end
2526
}
2627
raise NoPluginError, "unknown plugin named #{module_name}"

plugins/filter/image_source.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def parse_array(string)
2525
end
2626

2727
def run
28-
return_feeds = []
28+
@return_feeds = []
2929
@pipeline.each {|feeds|
3030
img_url = ""
3131
unless feeds.nil?
@@ -38,9 +38,9 @@ def run
3838
end
3939
}
4040
end
41-
return_feeds << feeds
41+
@return_feeds << feeds
4242
}
43-
return_feeds
43+
@return_feeds
4444
end
4545
end
4646
end

plugins/filter/reverse.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ def initialize(config, pipeline=[])
1616
end
1717

1818
def run
19-
return_feeds = []
19+
@return_feeds = []
2020
@pipeline.each { |feeds|
2121
return_feed_items = []
2222
unless feeds.nil?
2323
feeds.items.sort!{|a,b|
2424
a.date <=> b.date
2525
}
26-
return_feeds << feeds
26+
@return_feeds << feeds
2727
end
2828
}
29-
return_feeds
29+
@return_feeds
3030
end
3131
end
3232
end

plugins/filter/tumblr_resize.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ def resize(string)
2323
end
2424

2525
def run
26-
return_feeds = []
26+
@return_feeds = []
2727
@pipeline.each {|feeds|
2828
img_url = ""
2929
unless feeds.nil?
3030
feeds.items.each {|feed|
3131
feed.link = resize(feed.link) unless feed.link.nil?
3232
}
3333
end
34-
return_feeds << feeds
34+
@return_feeds << feeds
3535
}
36-
return_feeds
36+
@return_feeds
3737
end
3838
end
3939
end

plugins/store/database.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- coding: utf-8 -*-
22
# Name:: Automatic::Plugin::Store::Database
33
# Author:: kzgs
4+
# 774 <http://id774.net>
45
# Created:: Feb 27, 2012
5-
# Updated:: Jun 14, 2012
6+
# Updated:: Jun 17, 2012
67
# Copyright:: kzgs Copyright (c) 2012
78
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
89

@@ -30,7 +31,7 @@ def for_each_new_link
3031
def for_each_new_feed
3132
prepare_database
3233
existing_records = model_class.find(:all)
33-
return_feeds = []
34+
@return_feeds = []
3435
@pipeline.each { |feeds|
3536
unless feeds.nil?
3637
new_feed = false
@@ -40,10 +41,10 @@ def for_each_new_feed
4041
new_feed = true
4142
end
4243
}
43-
return_feeds << feeds if new_feed
44+
@return_feeds << feeds if new_feed
4445
end
4546
}
46-
return_feeds
47+
@return_feeds
4748
end
4849

4950
private

0 commit comments

Comments
 (0)