Sha256: 92b2f087b92146d06ce168d477838778aaf7f27e563d793418ad83b306df42c9
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module KepplerFrontend module Views # CodeHandler class RemoteJsHandler def initialize(view_data) @view = view_data @file = view_js(@view.name) end def install out_file = File.open(@file, 'w') out_file.puts("// #{@view.name} javascript Erb template") out_file.close true rescue StandardError false end def uninstall File.delete(@file) if File.exist?(@file) true rescue StandardError false end def update(name) File.rename(@file, view_js(name)) true rescue StandardError false end def output remote_js = File.readlines(@file) remote_js.join rescue StandardError false end def save(input) File.delete(@file) if File.exist?(@file) out_file = File.open(@file, 'w') out_file.puts(input) out_file.close true rescue StandardError false end private def view_js(name) front = KepplerFrontend::Urls::Front.new front.view_js(name) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems