Sha256: 880a4f35fd6f1d046e09e5cdb5e2ec37889b634231eff91198749a6170e01140

Contents?: true

Size: 800 Bytes

Versions: 11

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

module KepplerFrontend
  module Views
    # CodeHandler
    class HtmlHandler
      def initialize(view_data)
        @view = view_data
      end

      def install
        out_file = File.open(front.view(@view.name), 'w')
        out_file.puts(template)
        out_file.close
        true
      rescue StandardError
        false
      end

      def uninstall
        file = front.view(@view.name)
        File.delete(file) if File.exist?(file)
        true
      rescue StandardError
        false
      end

      private

      def front
        KepplerFrontend::Urls::Front.new
      end

      def template
        "<keppler-view id=\"#{@view.name}\">\n" \
        "  <h1> #{@view.name} template </h1>\n" \
        '</keppler-view>'
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
keppler-2.1.15 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/services/keppler_frontend/views/html_handler.rb