diff options
Diffstat (limited to 'new/lib/crys/processors')
-rw-r--r-- | new/lib/crys/processors/html_processor.rb | 7 | ||||
-rw-r--r-- | new/lib/crys/processors/rss_processor.rb | 28 |
2 files changed, 31 insertions, 4 deletions
diff --git a/new/lib/crys/processors/html_processor.rb b/new/lib/crys/processors/html_processor.rb index d5ea73d..bcc9768 100644 --- a/new/lib/crys/processors/html_processor.rb +++ b/new/lib/crys/processors/html_processor.rb @@ -14,21 +14,20 @@ module Crys @assets = [] end - def to_html + def parsed_content html_file = ERB.new(File.read(file_path)) html_file.result(local_binding) end - def filename file_path.scan(/.*\/(.*)\.erb/).flatten.first end - attr_reader :assets + attr_reader :assets, :file_path private - attr_reader :file_path, :image_dir + attr_reader :image_dir attr_writer :assets def local_binding diff --git a/new/lib/crys/processors/rss_processor.rb b/new/lib/crys/processors/rss_processor.rb new file mode 100644 index 0000000..bce48ad --- /dev/null +++ b/new/lib/crys/processors/rss_processor.rb @@ -0,0 +1,28 @@ +require_relative "common_functions" +require_relative "common_parts" + +module Crys + class RssProcessor + def initialize(file_path:, image_dir:) + @file_path = file_path + rss_file = File.read(file_path) + instance_eval(rss_file) + @assets = [] + end + + def parsed_content + rss.content + end + + def filename + rss.filename + end + + attr_reader :assets, :file_path + + private + + attr_reader :rss + + end +end |