diff options
Diffstat (limited to 'new/lib/crys/processors/html_processor.rb')
-rw-r--r-- | new/lib/crys/processors/html_processor.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/new/lib/crys/processors/html_processor.rb b/new/lib/crys/processors/html_processor.rb index d5ea73d..33116ce 100644 --- a/new/lib/crys/processors/html_processor.rb +++ b/new/lib/crys/processors/html_processor.rb @@ -1,38 +1,38 @@ +# frozen_string_literal: true + require 'erb' -require_relative "common_functions" -require_relative "common_parts" +require_relative 'common_functions' +require_relative 'common_parts' module Crys class HtmlProcessor - include CommonFunctions include CommonParts - + def initialize(file_path:, image_dir:) @file_path = file_path @image_dir = image_dir @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 + file_path.scan(%r{.*/(.*)\.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 - local_binding ||= binding.clone + @local_binding ||= binding.clone end end end |