appom 0.3.1 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3879fa2db3ae094cbc627ef932b190a4a9120b7e93105345c2acabff950c711e
4
- data.tar.gz: fe2539b5aec732d111043ce739ef822c614eff9b3e5d1209ddb46e2053c91ad9
3
+ metadata.gz: 7dfe63bdf19bf6f40316e2936d3999a4b38c318fea12b9c6c4da67349ac0e5d5
4
+ data.tar.gz: 0fd90a46359d87728ef19c10369710a47957ce23773e7b850531e9751a5656c9
5
5
  SHA512:
6
- metadata.gz: 4f5f0c93e6b96ff2185537a68b7fcae3e484204f439090dd71ef18e8a46952ea6798768f1c4d5e7b949b3995fb23313ed3d5af46502cf46bc142ad33d3a5e74c
7
- data.tar.gz: 801e72d60b37ae6fa475093eb39b4f85a5324bb27d725b908516ba9f41b6be9804abb31943758972f1a8f4df4f1dd0a0af4fd98d666fc8a6723c3198218fedb7
6
+ metadata.gz: 257d602e52213df6d7cf4bc87c8b40aa97926047bfa0af025f226c68c215a8261cf6e8e6327de02c12ddec8acf14b8b5455e6daa4197156cb2c5c7c91c4236fc
7
+ data.tar.gz: d8ddb29f6881a3e9ab4204917642f36f2767359f77e614fe43785c36e24bd8cef8331500edc0c8c8f2f669cf97f1527485d918b4bbba102740f3c808032fe71c
@@ -4,18 +4,30 @@ module Appom
4
4
  klass.extend ClassMethods
5
5
  end
6
6
 
7
- module ClassMethods
8
- attr_reader :mapped_items
7
+ # Raise if contain a block
8
+ def raise_if_block(obj, name, has_block, type)
9
+ return unless has_block
9
10
 
10
- # Raise if contain a block
11
- def raise_if_block(obj, name, has_block, type)
12
- return unless has_block
11
+ puts "Type passed in: #{type}"
12
+ puts "#{obj.class}##{name} does not accept blocks"
13
13
 
14
- puts "Type passed in: #{type}"
15
- puts "#{obj.class}##{name} does not accept blocks"
14
+ raise Appom::UnsupportedBlockError
15
+ end
16
16
 
17
- raise Appom::UnsupportedBlockError
18
- end
17
+ ##
18
+ # Options re-combiner. This takes the original inputs and combines
19
+ # them such that there is only one hash passed as a final argument
20
+ # to Appium.
21
+ #
22
+ def merge_args(find_args, runtime_args)
23
+ find_args = find_args.dup.flatten
24
+ runtime_args = runtime_args.dup
25
+
26
+ [*find_args, *runtime_args]
27
+ end
28
+
29
+ module ClassMethods
30
+ attr_reader :mapped_items
19
31
 
20
32
  ##
21
33
  #
@@ -31,9 +43,9 @@ module Appom
31
43
  #
32
44
  def element(name, *find_args)
33
45
  build(name, *find_args) do |*runtime_args, &block|
34
- raise_if_block(self, name, !block.nil?, :element)
35
46
  define_method(name) do
36
- find(*find_args)
47
+ raise_if_block(self, name, !block.nil?, :element)
48
+ find(*merge_args(find_args, runtime_args))
37
49
  end
38
50
  end
39
51
  end
@@ -52,9 +64,9 @@ module Appom
52
64
  #
53
65
  def elements(name, *find_args)
54
66
  build(name, *find_args) do |*runtime_args, &block|
55
- raise_if_block(self, name, !block.nil?, :elements)
56
67
  define_method(name) do
57
- all(*find_args)
68
+ raise_if_block(self, name, !block.nil?, :elements)
69
+ all(*merge_args(find_args, runtime_args))
58
70
  end
59
71
  end
60
72
  end
@@ -1,3 +1,3 @@
1
1
  module Appom
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry.Tran
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-23 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appium_lib