jarib-celerity 0.0.5.5 → 0.0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,31 @@
1
1
  module Celerity
2
2
  class Browser
3
3
  class << self
4
- # Added for Watir compatability - not in use by Celerity
4
+
5
+ # Added for Watir compatibility - not in use by Celerity
5
6
  attr_accessor :speed, :attach_timeout, :visible
6
- # Added for Watir compatability - not in use by Celerity
7
+ # Added for Watir compatibility - not in use by Celerity
7
8
  alias_method :start_window, :start
8
- # Added for Watir compatability - not in use by Celerity
9
+ # Added for Watir compatibility - not in use by Celerity
9
10
  def reset_attach_timeout; @attach_timeout = 2.0; end
10
- # Added for Watir compatability - not in use by Celerity
11
+ # Added for Watir compatibility - not in use by Celerity
11
12
  def each; end
12
- # Added for Watir compatability - not in use by Celerity
13
+ # Added for Watir compatibility - not in use by Celerity
13
14
  def quit; end
14
- # Added for Watir compatability - not in use by Celerity
15
+ # Added for Watir compatibility - not in use by Celerity
15
16
  def set_fast_speed; @speed = :fast; end
16
- # Added for Watir compatability - not in use by Celerity
17
+ # Added for Watir compatibility - not in use by Celerity
17
18
  def set_slow_speed; @speed = :slow; end
18
19
  end
19
20
 
20
- # Added for Watir compatability - not in use by Celerity
21
+ # Added for Watir compatibility - not in use by Celerity
21
22
  attr_accessor :visible
22
23
 
23
- # Added for Watir compatability - not in use by Celerity
24
+ # Added for Watir compatibility - not in use by Celerity
24
25
  def bring_to_front; true; end
25
- # Added for Watir compatability - not in use by Celerity
26
+ # Added for Watir compatibility - not in use by Celerity
26
27
  def speed=(s); s end
27
- # Added for Watir compatability - not in use by Celerity
28
+ # Added for Watir compatibility - not in use by Celerity
28
29
  def status; '' end
29
30
  end
30
31
 
data/lib/celerity.rb CHANGED
@@ -25,7 +25,7 @@ require "celerity/version"
25
25
  require "celerity/exception"
26
26
  require "celerity/clickable_element"
27
27
  require "celerity/disabled_element"
28
- require "celerity/element_collections"
28
+ require "celerity/element_collection"
29
29
  require "celerity/collections"
30
30
  require "celerity/element_locator"
31
31
  require "celerity/identifier"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarib-celerity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.5
4
+ version: 0.0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
@@ -11,17 +11,18 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-02-10 00:00:00 -08:00
14
+ date: 2009-02-19 00:00:00 -08:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: hoe
19
+ type: :development
19
20
  version_requirement:
20
21
  version_requirements: !ruby/object:Gem::Requirement
21
22
  requirements:
22
23
  - - ">="
23
24
  - !ruby/object:Gem::Version
24
- version: 1.8.2
25
+ version: 1.8.3
25
26
  version:
26
27
  description: "Celerity is a JRuby wrapper around HtmlUnit \xE2\x80\x93 a headless Java browser with JavaScript support. It provides a simple API for programmatic navigation through web applications. Celerity aims at being API compatible with Watir."
27
28
  email: jari.bakken@finn.no
@@ -1,82 +0,0 @@
1
- module Celerity
2
- # This class is the superclass for the iterator classes (Buttons, Links, Spans etc.)
3
- # It would normally only be accessed by the iterator methods (Browser#spans, Browser#links, ...).
4
- class ElementCollections
5
- include Enumerable
6
-
7
- # @api private
8
- def initialize(container, how = nil, what = nil)
9
- @container = container
10
- @object = (how == :object ? what : nil)
11
- @length = length
12
- end
13
-
14
- # @return [Fixnum] The number of elements in this collection.
15
- def length
16
- if @object
17
- @object.length
18
- else
19
- @elements ||= ElementLocator.new(@container, element_class).elements_by_idents
20
- @elements.size
21
- end
22
- end
23
- alias_method :size, :length
24
-
25
- # @yieldparam [Celerity::Element] element Iterate through the elements in this collection.
26
- #
27
- def each
28
- if @elements
29
- @elements.each { |e| yield(element_class.new(@container, :object, e)) }
30
- else
31
- 0.upto(@length - 1) { |i| yield iterator_object(i) }
32
- end
33
-
34
- @length
35
- end
36
-
37
- # Get the element at the given index.
38
- # This is 1-indexed to keep compatibility with Watir - subject to change.
39
- # Also note that because of Watir's lazy loading, this will return an Element
40
- # instance even if the index is out of bounds.
41
- #
42
- # @param [Fixnum] n Index of wanted element, 1-indexed.
43
- # @return [Celerity::Element] Returns a subclass of Celerity::Element
44
- def [](n)
45
- if @elements && @elements[n - INDEX_OFFSET]
46
- element_class.new(@container, :object, @elements[n - INDEX_OFFSET])
47
- else
48
- iterator_object(n - INDEX_OFFSET)
49
- end
50
- end
51
-
52
- # Get the first element in this collection. (Celerity-specific)
53
- #
54
- # @return [Celerity::Element] Returns a subclass of Celerity::Element
55
- def first
56
- self[INDEX_OFFSET]
57
- end
58
-
59
- # Get the last element in this collection. (Celerity-specific)
60
- #
61
- # @return [Celerity::Element] Returns a subclass of Celerity::Element
62
- def last
63
- self[INDEX_OFFSET - 1]
64
- end
65
-
66
- # Note: This can be quite useful in irb:
67
- #
68
- # puts browser.text_fields
69
- #
70
- # @return [String] A string representation of all elements in this collection.
71
- def to_s
72
- map { |e| e.to_s }.join("\n")
73
- end
74
-
75
- private
76
-
77
- def iterator_object(i)
78
- element_class.new(@container, :index, i+1)
79
- end
80
-
81
- end # ElementCollections
82
- end # Celerity