module Gitlab::Triage::Resource::Context
Constants
- EvaluationError
Public Class Methods
build(resource, **options)
click to toggle source
# File lib/gitlab/triage/resource/context.rb, line 15 def self.build(resource, **options) const_name = (resource[:type] || 'Base') .to_s.singularize.camelcase Resource.const_get(const_name).new(resource, **options).extend(self) end
Public Instance Methods
eval(ruby)
click to toggle source
# File lib/gitlab/triage/resource/context.rb, line 22 def eval(ruby) instance_eval <<~RUBY, __FILE__, __LINE__ + 1 begin #{ruby} rescue StandardError, ScriptError => e raise EvaluationError.new(e.message) end RUBY rescue EvaluationError => e # This way we could obtain the original backtrace and error # If we just let instance_eval raise an error, the backtrace # won't contain the actual line where it's giving an error. raise e.cause end
Private Instance Methods
instance_version()
click to toggle source
# File lib/gitlab/triage/resource/context.rb, line 39 def instance_version @instance_version ||= InstanceVersion.new(parent: self) end