bucky-core 0.9.11 → 0.9.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 615990b26e294ad53bd00a796a530a2df0c7e182
4
- data.tar.gz: a8ec5a655e5d1dc0d52f8e3e14741da7c7dae530
3
+ metadata.gz: 13cebeab73b7e81980d36a07515ac17fb040eea9
4
+ data.tar.gz: 407b0fc24a25d52ce5977fa2a63e2c7b5a5b1021
5
5
  SHA512:
6
- metadata.gz: 52ffc8308d95f47591c4f0c640b26c00a3065338a39714f87213983ca1e762ca4d6df794ae57705325f06a5a1c6e2c8be050207471f1324a15b08b162c55aa20
7
- data.tar.gz: 65f1321eb76cfa31516d01f6a20ade986a78201bdf00f8bac8e9baf8f9b6c5e07ed8a61021c29c898d7b08a38031064140313bc5fa372c5336997a248add6ed8
6
+ metadata.gz: 2c49d372f9e4a36a81daaf07fe7309caf7286e5dbbfd6ad4094bc29eaded54f4bf51c1ed84ad3813858b974c5cbcd63729d87438ebe3b881a76c779ee69ba1b1
7
+ data.tar.gz: 65ba083425e8b97bc0e59486c3663e8e293c1add4cb1e4cd89749dea1333e078e79bd40bb73235122ae020631e90784ad35eb07207b7e315b65690e731ee8811
@@ -54,7 +54,22 @@ module Bucky
54
54
 
55
55
  elements = @driver.find_elements(method_name, value)
56
56
  raise_if_elements_empty(elements, method_name, value)
57
- elements.first.instance_eval { define_singleton_method('[]') { |num| elements[num] } }
57
+
58
+ get_element_or_attribute = lambda do |elems, arg|
59
+ # return WebElement
60
+ return elems[arg] if arg.is_a? Integer
61
+ # return String(Value of WebElement`s attribute)
62
+ return elems.first.attribute(arg) if [String, Symbol].include? arg.class
63
+
64
+ raise StandardError, "Invalid argument type. Expected type is Integer/String/Symbol.\n\
65
+ | Got argument:#{arg}, type:#{arg.class}."
66
+ end
67
+
68
+ elements.first.instance_eval do
69
+ define_singleton_method('[]') { |arg| get_element_or_attribute.call(elements, arg) }
70
+ %w[each length].each { |m| define_singleton_method(m) { elements.send(m) } }
71
+ end
72
+
58
73
  elements.first
59
74
  rescue StandardError => e
60
75
  Bucky::Core::Exception::WebdriverException.handle(e)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bucky
4
4
  module Version
5
- VERSION = '0.9.11'
5
+ VERSION = '0.9.12'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bucky-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11
4
+ version: 0.9.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaotoKishino
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2019-07-04 00:00:00.000000000 Z
16
+ date: 2019-07-09 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: awesome_print