Class: Watirmark::ProcessPage
- Defined in:
- lib/watirmark/page/process_page.rb
Instance Attribute Summary collapse
-
#active_page_method ⇒ Object
Returns the value of attribute active_page_method.
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#always_activate_parent ⇒ Object
Returns the value of attribute always_activate_parent.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#name ⇒ Object
Returns the value of attribute name.
-
#navigate_method ⇒ Object
Returns the value of attribute navigate_method.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#root ⇒ Object
Returns the value of attribute root.
-
#submit_method ⇒ Object
Returns the value of attribute submit_method.
Class Method Summary collapse
- .active_page_method_default ⇒ Object
- .active_page_method_default=(proc) ⇒ Object
- .navigate_method_default ⇒ Object
- .navigate_method_default=(proc) ⇒ Object
- .submit_method_default ⇒ Object
- .submit_method_default=(proc) ⇒ Object
Instance Method Summary collapse
- #<<(x) ⇒ Object
- #activate ⇒ Object
- #active? ⇒ Boolean
- #active_page ⇒ Object
- #aliases ⇒ Object
- #goto_process_page ⇒ Object
- #in_submenu(active_page, requested_page) ⇒ Object
-
#initialize(name = '', parent = nil, active_page = nil, navigate_page = nil, submit_page = nil) ⇒ ProcessPage
constructor
A new instance of ProcessPage.
- #navigate ⇒ Object
- #submit ⇒ Object
-
#underscored_name(name = @name) ⇒ Object
Give the full name of this process page, including the parent process pages.
Constructor Details
#initialize(name = '', parent = nil, active_page = nil, navigate_page = nil, submit_page = nil) ⇒ ProcessPage
Returns a new instance of ProcessPage.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/watirmark/page/process_page.rb', line 38 def initialize(name='', parent=nil, active_page=nil, navigate_page=nil, submit_page=nil) @name = name @parent = parent @keywords = [] @root = false @always_activate_parent = false @alias = [] @active_page_method = active_page if active_page @navigate_method = navigate_page if navigate_page @submit_method = submit_page if submit_page end |
Instance Attribute Details
#active_page_method ⇒ Object
Returns the value of attribute active_page_method.
6 7 8 |
# File 'lib/watirmark/page/process_page.rb', line 6 def active_page_method @active_page_method end |
#alias ⇒ Object
Returns the value of attribute alias.
5 6 7 |
# File 'lib/watirmark/page/process_page.rb', line 5 def alias @alias end |
#always_activate_parent ⇒ Object
Returns the value of attribute always_activate_parent.
5 6 7 |
# File 'lib/watirmark/page/process_page.rb', line 5 def always_activate_parent @always_activate_parent end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
4 5 6 |
# File 'lib/watirmark/page/process_page.rb', line 4 def keywords @keywords end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/watirmark/page/process_page.rb', line 5 def name @name end |
#navigate_method ⇒ Object
Returns the value of attribute navigate_method.
6 7 8 |
# File 'lib/watirmark/page/process_page.rb', line 6 def navigate_method @navigate_method end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/watirmark/page/process_page.rb', line 4 def parent @parent end |
#root ⇒ Object
Returns the value of attribute root.
5 6 7 |
# File 'lib/watirmark/page/process_page.rb', line 5 def root @root end |
#submit_method ⇒ Object
Returns the value of attribute submit_method.
6 7 8 |
# File 'lib/watirmark/page/process_page.rb', line 6 def submit_method @submit_method end |
Class Method Details
.active_page_method_default ⇒ Object
33 34 35 |
# File 'lib/watirmark/page/process_page.rb', line 33 def active_page_method_default @@active_page_method_default end |
.active_page_method_default=(proc) ⇒ Object
21 22 23 |
# File 'lib/watirmark/page/process_page.rb', line 21 def active_page_method_default=(proc) @@active_page_method_default = proc end |
.navigate_method_default ⇒ Object
25 26 27 |
# File 'lib/watirmark/page/process_page.rb', line 25 def navigate_method_default @@navigate_method_default end |
.navigate_method_default=(proc) ⇒ Object
13 14 15 |
# File 'lib/watirmark/page/process_page.rb', line 13 def navigate_method_default=(proc) @@navigate_method_default = proc end |
.submit_method_default ⇒ Object
29 30 31 |
# File 'lib/watirmark/page/process_page.rb', line 29 def submit_method_default @@submit_method_default end |
.submit_method_default=(proc) ⇒ Object
17 18 19 |
# File 'lib/watirmark/page/process_page.rb', line 17 def submit_method_default=(proc) @@submit_method_default = proc end |
Instance Method Details
#<<(x) ⇒ Object
68 69 70 |
# File 'lib/watirmark/page/process_page.rb', line 68 def <<(x) @keywords << x.to_sym end |
#activate ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/watirmark/page/process_page.rb', line 58 def activate return if (@root || active?) if @always_activate_parent @parent.goto_process_page else @parent.activate if @parent end goto_process_page end |
#active? ⇒ Boolean
100 101 102 103 104 105 |
# File 'lib/watirmark/page/process_page.rb', line 100 def active? page = active_page return true if (page, underscored_name) aliases.each { |a| return true if (page, underscored_name(a)) } unless aliases.empty? false end |
#active_page ⇒ Object
92 93 94 |
# File 'lib/watirmark/page/process_page.rb', line 92 def active_page instance_eval &(@active_page_method || @@active_page_method_default) end |
#aliases ⇒ Object
96 97 98 |
# File 'lib/watirmark/page/process_page.rb', line 96 def aliases @alias ||= [] end |
#goto_process_page ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/watirmark/page/process_page.rb', line 72 def goto_process_page unless navigate aliases.each do |alias_name| alias_process_page = self.dup alias_process_page.alias = [] alias_process_page.name = alias_name alias_process_page.alias = nil alias_process_page.goto_process_page end end end |
#in_submenu(active_page, requested_page) ⇒ Object
107 108 109 |
# File 'lib/watirmark/page/process_page.rb', line 107 def (active_page, requested_page) !!(active_page.to_s.downcase.delete('>').gsub(/\s+/, '_') =~ /^#{requested_page}/) end |
#navigate ⇒ Object
84 85 86 |
# File 'lib/watirmark/page/process_page.rb', line 84 def navigate instance_eval &(@navigate_method || @@navigate_method_default) end |
#submit ⇒ Object
88 89 90 |
# File 'lib/watirmark/page/process_page.rb', line 88 def submit instance_eval &(@submit_method || @@submit_method_default) end |
#underscored_name(name = @name) ⇒ Object
Give the full name of this process page, including the parent process pages. The argument allows us to easily get the full path for alias names.
53 54 55 56 |
# File 'lib/watirmark/page/process_page.rb', line 53 def underscored_name(name=@name) u_name = (@parent && !@parent.root) ? "#{@parent.underscored_name}_#{name}" : name u_name.downcase.gsub(/\s+|\//, '_') if u_name end |