-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use zeitwerk for autoloading (#47)
* feat: use zeitwerk for autoloading * fix memoizing of postprocessor/extractor
- Loading branch information
1 parent
f4e2634
commit bce523d
Showing
7 changed files
with
34 additions
and
44 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
require_relative 'attribute_post_processors/html_to_markdown' | ||
require_relative 'attribute_post_processors/parse_time' | ||
require_relative 'attribute_post_processors/parse_uri' | ||
require_relative 'attribute_post_processors/sanitize_html' | ||
require_relative 'attribute_post_processors/substring' | ||
require_relative 'attribute_post_processors/template' | ||
|
||
module Html2rss | ||
## | ||
# Provides a namespace for attribute post processors. | ||
module AttributePostProcessors | ||
def self.get_processor(name) | ||
camel_cased_name = name.split('_').map(&:capitalize).join | ||
class_name = ['Html2rss', 'AttributePostProcessors', camel_cased_name].join('::') | ||
@get_processor ||= Hash.new do |processors, key| | ||
camel_cased_name = key.split('_').map(&:capitalize).join | ||
class_name = ['Html2rss', 'AttributePostProcessors', camel_cased_name].join('::') | ||
processors[key] = Object.const_get(class_name) | ||
end | ||
|
||
Object.const_get(class_name) | ||
@get_processor[name] | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
require 'rss' | ||
require_relative 'item' | ||
|
||
module Html2rss | ||
## | ||
|
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
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