Class: ObjectRepository::Repository
- Inherits:
-
Object
- Object
- ObjectRepository::Repository
- Includes:
- Enumerable
- Defined in:
- lib/watir-or/repository.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #get(name) ⇒ Object
-
#initialize(file, browser, options = nil) ⇒ Repository
constructor
A new instance of Repository.
- #inspect ⇒ Object
Constructor Details
#initialize(file, browser, options = nil) ⇒ Repository
Returns a new instance of Repository.
6 7 8 9 10 11 12 |
# File 'lib/watir-or/repository.rb', line 6 def initialize(file, browser, = nil) @file = file @elements = [] @browser = browser @type = File.extname(@file).delete('.') fill_elements() end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
4 5 6 |
# File 'lib/watir-or/repository.rb', line 4 def browser @browser end |
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
4 5 6 |
# File 'lib/watir-or/repository.rb', line 4 def elements @elements end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
4 5 6 |
# File 'lib/watir-or/repository.rb', line 4 def file @file end |
Instance Method Details
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/watir-or/repository.rb', line 14 def each(&block) @elements.each { |el| yield el } end |
#get(name) ⇒ Object
18 19 20 21 22 |
# File 'lib/watir-or/repository.rb', line 18 def get(name) element = find { |el| el.name == name } raise "Couldn't find repository element with #{name.inspect}" if element.nil? return element end |
#inspect ⇒ Object
24 25 26 |
# File 'lib/watir-or/repository.rb', line 24 def inspect @elements.inspect end |