blob: 52ce65ac2d5a6935590ab7c880526d1e15eeba07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# frozen_string_literal: true
require 'rss'
module Crys
module CommonFunctions
def project_root
File.dirname(File.dirname(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))))).to_s
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)
else
puts url
end
RSS::Parser.parse(rss)
end
end
end
|