class Flex::Scope
never instantiate this class directly: it is automatically done by the scoped method
Constants
- SCOPED_METHODS
Public Instance Methods
inspect()
click to toggle source
# File lib/flex/scope.rb, line 13 def inspect "#<#{self.class.name} #{self}>" end
method_missing(meth, *args, &block)
click to toggle source
Calls superclass method
# File lib/flex/scope.rb, line 21 def method_missing(meth, *args, &block) super unless respond_to?(meth) case when is_context_scope?(meth) deep_merge self[:context].send(meth, *args, &block) when is_self_scope?(meth) deep_merge self[:self_context].send(meth, *args, &block) when is_template?(meth) self[:context].send(meth, deep_merge(*args), &block) end end
respond_to?(meth, private=false)
click to toggle source
Calls superclass method
# File lib/flex/scope.rb, line 17 def respond_to?(meth, private=false) super || is_template?(meth) || is_context_scope?(meth) || is_self_scope?(meth) end
Private Instance Methods
is_context_scope?(name)
click to toggle source
# File lib/flex/scope.rb, line 39 def is_context_scope?(name) self[:context].respond_to?(:scope_methods) && self[:context].scope_methods.include?(name.to_sym) end
is_self_scope?(name)
click to toggle source
only used for AR scopes, when you namespace the scope module
# File lib/flex/scope.rb, line 44 def is_self_scope?(name) self[:self_context].respond_to?(:scope_methods) && self[:self_context].scope_methods.include?(name.to_sym) end
is_template?(name)
click to toggle source
# File lib/flex/scope.rb, line 35 def is_template?(name) self[:context].respond_to?(:template_methods) && self[:context].template_methods.include?(name.to_sym) end