Sha256: 68eccaa4fbf831340ab73a019e496d48a3406311ef68e5ae05c12b301eea9972

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

def perform(action_class, **kwargs)
  raise PUNK::InternalServerError, "Not an action: #{action_class}" unless action_class < PUNK::Action
  action_class.perform(**kwargs)
ensure
  SemanticLogger.flush
end

def present(view_class, **kwargs)
  raise PUNK::InternalServerError, "Not a view: #{view_class}" unless view_class < PUNK::View
  view_class.present(**kwargs)
ensure
  SemanticLogger.flush
end

def run(service_class, **kwargs)
  raise PUNK::InternalServerError, "Not a service: #{service_class}" unless service_class.superclass == PUNK::Service
  service_class.run(**kwargs).result
ensure
  SemanticLogger.flush
end

def reload!
  ["actions", "models", "views", "services", "workers"].each do |dir|
    path = File.join(PUNK.get.app.path, dir)
    Dir.glob(File.join(path, "**/*.rb")).each { |file| load(file) }
  end
  "Reloaded all actions, models, views, services and workers."
ensure
  SemanticLogger.flush
end

Pry.config.print =
  proc do |output, value|
    SemanticLogger.flush
    output.puts "=> #{value.inspect}"
  end
Pry.config.prompt_name = "🎤 "

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
punk-0.4.1 lib/punk/core/pry.rb