Module: Capybara::Pagemap
- Defined in:
- lib/capybara/pagemap.rb,
lib/capybara/pagemap/input.rb,
lib/capybara/pagemap/button.rb,
lib/capybara/pagemap/select.rb,
lib/capybara/pagemap/version.rb,
lib/capybara/pagemap/configuration.rb
Overview
Pagemap module extend functionality to clases to map capybara nodes
Defined Under Namespace
Modules: Button, ClassMethods, Input, Select Classes: Configuration
Constant Summary collapse
- MODULES_ENABLED =
configuration.enabled.freeze
- VERSION =
'0.2.2'
Class Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #valid? ⇒ Boolean
Methods included from Select
#select_getter_build_and_send, #select_input_build_and_send, #select_method_missing, #select_opt_build_and_send, #select_respond_to_missing?, #select_validator_for, #select_value_build_and_send
Methods included from Button
#button_method_missing, #button_respond_to_missing?, #button_validator_for
Methods included from Input
#input_build_and_send, #input_getter_build_and_send, #input_method_missing, #input_respond_to_missing?, #input_setter_build_and_send, #input_validator_for
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/capybara/pagemap.rb', line 41 def method_missing(method_name, *args, &block) self.class.node_definitions.each_value do |definition| MODULES_ENABLED.each do |type| next if definition[:type] != type result = send("#{type}_method_missing", method_name, args, block) if respond_to?(method_name) return result if result end end super end |
Class Attribute Details
.configuration ⇒ Object
10 11 12 |
# File 'lib/capybara/pagemap/configuration.rb', line 10 def self.configuration @configuration ||= Configuration.new end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
14 15 16 |
# File 'lib/capybara/pagemap/configuration.rb', line 14 def self.configure yield(configuration) end |
.included(base) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/capybara/pagemap.rb', line 18 def self.included(base) base.extend(ClassMethods) MODULES_ENABLED.each do |mod| base.extend(Object.const_get("Capybara::Pagemap::#{mod.capitalize}::ClassMethods")) end end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
52 53 54 55 56 57 58 59 |
# File 'lib/capybara/pagemap.rb', line 52 def respond_to_missing?(method_name, include_private = false) self.class.node_definitions.map do |_, definition| MODULES_ENABLED.map do |type| next if definition[:type] != type send("#{type}_respond_to_missing?", method_name, include_private) end.compact.all? end.all? end |
#valid? ⇒ Boolean
32 33 34 35 36 37 38 39 |
# File 'lib/capybara/pagemap.rb', line 32 def valid? self.class.node_definitions.map do |node, definition| MODULES_ENABLED.map do |type| next if definition[:type] != type send("#{type}_validator_for", node) end.compact.all? end.all? end |