lib/domkey/view/page_object.rb in domkey-0.3.0 vs lib/domkey/view/page_object.rb in domkey-0.3.1
- old
+ new
@@ -75,9 +75,26 @@
def options
return widgetry_dispatcher.options unless package.respond_to?(:each_pair)
Hash[package.map { |key, pageobject| [key, pageobject.options] }]
end
+
+ # @api private
+ # delegate to element when element responds to message
+ def method_missing(message, *args, &block)
+ if respond_to_missing?(message, false)
+ element.__send__(message, *args, &block)
+ else
+ super
+ end
+ end
+
+ # @api private
+ # ruturn true when element.respond_to? message so we can delegate with confidence
+ def respond_to_missing?(message, include_private = false)
+ element.respond_to?(message) ? true : false
+ end
+
private
# wrap instantiator with strategy for setting and getting value for underlying object
# expects that element to respond to set and value
# @returns [Widgetry::Dispatcher] that responds to set, value, options
\ No newline at end of file