class KManager::Resources::RubyFileResource

Represents a Ruby file resource.

Public Class Methods

new(**opts) click to toggle source
Calls superclass method KManager::Resources::FileResource::new
# File lib/k_manager/resources/ruby_file_resource.rb, line 7
def initialize(**opts)
  super(**opts)
  @type = :ruby
end

Public Instance Methods

register_document() click to toggle source
# File lib/k_manager/resources/ruby_file_resource.rb, line 12
def register_document
  KManager.target_resource = self

  Object.class_eval content

# rescue StandardError => exception
#   # Report the error but still add the document so that you can see
#   # it in the ResourceDocument list, it will be marked as Error
#   resource.error = exception

#   L.exception resource.error
ensure
  KManager.target_resource = nil

  # A regular ruby file would not add resource_documents
  # so create one manually
  @document = super if documents.length.zero?
end