Class: Insite::UndefinedPage
- Inherits:
-
Object
- Object
- Insite::UndefinedPage
- Extended by:
- ComponentMethods
- Includes:
- CommonMethods, ComponentInstanceMethods
- Defined in:
- lib/insite/page/undefined_page.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#has_fragment ⇒ Object
readonly
Returns the value of attribute has_fragment.
-
#page_attributes ⇒ Object
readonly
Returns the value of attribute page_attributes.
-
#page_elements ⇒ Object
(also: #component_elements)
readonly
Returns an empty Array (since the page hasn’t been defined.).
-
#page_features ⇒ Object
readonly
Returns the value of attribute page_features.
-
#page_url ⇒ Object
readonly
Returns the value of attribute page_url.
-
#required_arguments ⇒ Object
readonly
Returns the value of attribute required_arguments.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#url_matcher ⇒ Object
readonly
Returns the value of attribute url_matcher.
-
#url_template ⇒ Object
readonly
Returns the value of attribute url_template.
Instance Method Summary collapse
-
#defined? ⇒ Boolean
Always returns false.
- #driver ⇒ Object
- #html ⇒ Object
-
#initialize(site) ⇒ UndefinedPage
constructor
A new instance of UndefinedPage.
-
#method_missing(mth, *args, &block) ⇒ Object
TODO: Do the same cache check that’s done for a defined page and reapply the method if the cache is updated and the new page DOES respond to the method.
-
#nokogiri ⇒ Object
Returns a Nokogiri object for the page HTML.
-
#on_page? ⇒ Boolean
Similar to the method that you can call on a page object you’ve defined (but always returns false since the Undefined page class is only returned when the current page doesn’t match up to any page that you’ve actually defined..
-
#title ⇒ Object
Returns the page title displayed by the browser.
-
#url ⇒ Object
Returns the current URL.
Methods included from CommonMethods
#document, #process_browser, #update_object
Constructor Details
#initialize(site) ⇒ UndefinedPage
Returns a new instance of UndefinedPage.
23 24 25 26 27 |
# File 'lib/insite/page/undefined_page.rb', line 23 def initialize(site) @site = site @browser = process_browser @url = @site.browser.url end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mth, *args, &block) ⇒ Object
TODO: Do the same cache check that’s done for a defined page and reapply the method if the cache is updated and the new page DOES respond to the method.
31 32 33 34 |
# File 'lib/insite/page/undefined_page.rb', line 31 def method_missing(mth, *args, &block) raise NoMethodError, "Could not apply #{mth}. The current page couldn't " \ "be recognized. Current URL #{@browser.url}" end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def arguments @arguments end |
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def browser @browser end |
#has_fragment ⇒ Object (readonly)
Returns the value of attribute has_fragment.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def has_fragment @has_fragment end |
#page_attributes ⇒ Object (readonly)
Returns the value of attribute page_attributes.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def page_attributes @page_attributes end |
#page_elements ⇒ Object (readonly) Also known as: component_elements
Returns an empty Array (since the page hasn’t been defined.)
49 50 51 |
# File 'lib/insite/page/undefined_page.rb', line 49 def page_elements @page_elements end |
#page_features ⇒ Object (readonly)
Returns the value of attribute page_features.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def page_features @page_features end |
#page_url ⇒ Object (readonly)
Returns the value of attribute page_url.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def page_url @page_url end |
#required_arguments ⇒ Object (readonly)
Returns the value of attribute required_arguments.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def required_arguments @required_arguments end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def site @site end |
#url_matcher ⇒ Object (readonly)
Returns the value of attribute url_matcher.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def url_matcher @url_matcher end |
#url_template ⇒ Object (readonly)
Returns the value of attribute url_template.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def url_template @url_template end |
Instance Method Details
#defined? ⇒ Boolean
Always returns false.
11 12 13 |
# File 'lib/insite/page/undefined_page.rb', line 11 def defined? false end |
#driver ⇒ Object
15 16 17 |
# File 'lib/insite/page/undefined_page.rb', line 15 def driver @browser.driver end |
#html ⇒ Object
19 20 21 |
# File 'lib/insite/page/undefined_page.rb', line 19 def html @browser.html end |
#nokogiri ⇒ Object
Returns a Nokogiri object for the page HTML.
37 38 39 |
# File 'lib/insite/page/undefined_page.rb', line 37 def nokogiri Nokogiri::HTML(html) end |
#on_page? ⇒ Boolean
Similar to the method that you can call on a page object you’ve defined (but always returns false since the Undefined page class is only returned when the current page doesn’t match up to any page that you’ve actually defined.
44 45 46 |
# File 'lib/insite/page/undefined_page.rb', line 44 def on_page? false end |
#title ⇒ Object
Returns the page title displayed by the browser.
60 61 62 |
# File 'lib/insite/page/undefined_page.rb', line 60 def title @browser.title end |
#url ⇒ Object
Returns the current URL.
55 56 57 |
# File 'lib/insite/page/undefined_page.rb', line 55 def url @browser.url end |