From bfd8209ad0d80b5027bea8a1a095dadc8bffdc61 Mon Sep 17 00:00:00 2001 From: mms Date: Sun, 5 Jan 2025 22:34:55 +0100 Subject: feat(new): splash page in progress --- new/lib/crys/processors/common_functions.rb | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 new/lib/crys/processors/common_functions.rb (limited to 'new/lib/crys/processors/common_functions.rb') diff --git a/new/lib/crys/processors/common_functions.rb b/new/lib/crys/processors/common_functions.rb new file mode 100644 index 0000000..f33c768 --- /dev/null +++ b/new/lib/crys/processors/common_functions.rb @@ -0,0 +1,31 @@ +require 'rss' + +module Crys + module CommonFunctions + def project_root + "#{File.dirname(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))))}" + end + + def process_image(file:, width: :auto) + full_path = image_dir + "/" + file + + image = ::Crys::ImageProcessor.new(path: full_path, filename: file, width: width) + assets << image + + image + end + + def fetch_rss(url: nil, name: nil) + if name + path = case name + when :main + "/public/index.xml" + end + + rss = File.read(project_root + path) + end + + RSS::Parser.parse(rss) + end + end +end -- cgit v1.2.3