Sha256: ef520b3274bdd9c324f80c6825ee1289ca412dfa352be42f77d9e98f1cd90589
Contents?: true
Size: 472 Bytes
Versions: 165
Compression:
Stored size: 472 Bytes
Contents
# frozen_string_literal: true module EacRubyUtils # Provides the method context which search and call a method in self and ancestor objects. module Contextualizable def context(method) current = self while current return current.send(method) if current.respond_to?(method) current = current.respond_to?(:parent) ? current.parent : nil end raise "Context method \"#{method}\" not found for #{self.class}" end end end
Version data entries
165 entries across 165 versions & 3 rubygems