Module: Quarto::ElementWrapper::Children
- Defined in:
- lib/quarto/children.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #method_missing_with_children(meth, *args) ⇒ Object
- #respond_to_with_children?(meth, include_private = false) ⇒ Boolean
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/quarto/children.rb', line 4 def self.included(base) base.extend(ClassMethods) base.class_eval do alias_method :method_missing_without_children, :method_missing alias_method :method_missing, :method_missing_with_children alias_method :respond_to_without_children?, :respond_to? alias_method :respond_to?, :respond_to_with_children? end end |
Instance Method Details
#method_missing_with_children(meth, *args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/quarto/children.rb', line 15 def method_missing_with_children(meth, *args) if self.class.has_child_named?(meth) child_obj(meth) elsif self.class.has_children_named?(meth) children_proxy(meth) elsif self.class.has_parent_named?(meth) wrapped_parent else method_missing_without_children(meth, *args) end end |
#respond_to_with_children?(meth, include_private = false) ⇒ Boolean
27 28 29 30 31 32 33 |
# File 'lib/quarto/children.rb', line 27 def respond_to_with_children?(meth, include_private = false) if self.class.has_child_named?(meth) or self.class.has_children_named?(meth) or self.class.has_parent_named?(meth) true else respond_to_without_children?(meth, include_private) end end |