Sha256: 2819e2601a76458969780760d740f6ec93953820b96798577c42a1e88b9d9e78
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
module Trestle # This module facilitiates the delegation of missing methods to a given @context variable. # # This allows code such as adapter and navigation blocks to be evaluated with access to methods from # both the Adapter/Navigation instance, as well as the controller/view from where they are invoked. module EvaluationContext protected def self.ruby2_keywords(*) end unless respond_to?(:ruby2_keywords, true) # Missing methods are called on the given context if available. # # We include private methods as methods such as current_user # are usually declared as private or protected. ruby2_keywords def method_missing(name, *args, &block) if context_responds_to?(name) @context.send(name, *args, &block) else super end end def respond_to_missing?(name, include_private=false) context_responds_to?(name) || super end private def context_responds_to?(name) @context && @context.respond_to?(name, true) end end end
Version data entries
7 entries across 7 versions & 1 rubygems