parfait 0.11.0 → 0.12.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
  SHA1:
3
- metadata.gz: 6ff8e6fb73203bae5fb8b29221e8036e767d6756
4
- data.tar.gz: 5d6768bc076105db4c642d6cbc3fc8324226a4cb
3
+ metadata.gz: 42b78e2a859a273ee6c9b67af8f4beda64f5816b
4
+ data.tar.gz: 2147824f3573fe0753d8061b751e18687d897ab7
5
5
  SHA512:
6
- metadata.gz: a01841f001507aa28b88ddfccc9354fa39c6e83b6a9b5b9388622dde4f70b100b7c9a74a6e3e2df3bf401872798c03fde690d423ad63e18ede57b2c02c36ce4c
7
- data.tar.gz: 19bf23e43506aeade6863e1fc0b50047a25e92baa2c772be9bff8100f6acf2efae4b74491cff3c440cb2b621df57321bb5cbf031382bf0b64915dee5710605d3
6
+ metadata.gz: a49ddc6bd8dea96666d89796dc4a05311bed7389565db018b3e3626a03be23c91de2ec0a4236cdcd54ced7f3c6c6a03ff080304c147cab6b047050e1bb531cb6
7
+ data.tar.gz: 4ee38181dc14f1e38ee0b53869987dfe8f704e49fa3616cc3ae63bf6fb0aa978edd2c1858e50b2bf3a77f557d9c30fa4b7bf6d1465c5bbf0bb82374e9a41ac54
@@ -12,6 +12,7 @@ module Parfait
12
12
  # +name+:: the name used to identify this control
13
13
  # +logtext+:: the text to be used when referring to this control in logs
14
14
  # +aliases+:: specifies an array of aliases for the control
15
+ # +parent+:: specifies the parent object (Region or Page) of this control
15
16
  #
16
17
  # *Example*
17
18
  #
@@ -23,11 +24,13 @@ module Parfait
23
24
  o = {
24
25
  :name => nil,
25
26
  :logtext => nil,
26
- :aliases => []
27
+ :aliases => [],
28
+ :parent => nil
27
29
  }.merge(opts)
28
30
  @name = o[:name]
29
- @aliases = o[:aliases]
30
31
  @logtext = o[:logtext]
32
+ @aliases = o[:aliases]
33
+ @parent = o[:parent]
31
34
 
32
35
  @set_method = nil
33
36
  @get_method = nil
@@ -60,6 +63,19 @@ module Parfait
60
63
  raise "Parfait::Control requires each alias in the array to be a string" unless my_alias.is_a?(String)
61
64
  end
62
65
  end
66
+
67
+ if @parent
68
+ if @parent.is_a? Parfait::Page
69
+ add_to_page(@parent)
70
+ else
71
+ if @parent.is_a? Parfait::Region
72
+ add_to_region(@parent)
73
+ else
74
+ raise "Parent specified for Control \"#{@name}\", but parent object type unrecognized."
75
+ end
76
+ end
77
+ end
78
+
63
79
  super
64
80
  end
65
81
 
@@ -21,6 +21,7 @@ module Parfait
21
21
  #
22
22
  # +name+:: the name used to identify this region
23
23
  # +aliases+:: specifies an array of aliases for the region
24
+ # +parent+:: specifies the parent object (Region or Page) of this control
24
25
  #
25
26
  # *Example*
26
27
  #
@@ -35,20 +36,24 @@ module Parfait
35
36
  # mypage = Parfait::Page.new(
36
37
  # :name => "User List"
37
38
  # )
38
- # mybrowser.add_page(mypage)
39
+ # myapp.add_page(mypage)
39
40
  #
40
41
  # # Define the region
41
42
  # myregion = Parfait::Region.new(
42
- # :name => "User"
43
+ # :name => "User",
44
+ # :parent => mypage
43
45
  # )
44
46
  #
45
47
  def initialize(opts = {})
46
48
  o = {
47
49
  :name => nil,
48
- :aliases => []
50
+ :aliases => [],
51
+ :parent => nil
49
52
  }.merge(opts)
50
53
  @name = o[:name]
51
54
  @aliases = o[:aliases]
55
+ @parent = o[:parent]
56
+
52
57
  @controls = Hash.new
53
58
  @regions = Hash.new
54
59
  @pages = Hash.new
@@ -68,6 +73,19 @@ module Parfait
68
73
  raise "Parfait::Region requires each alias in the array to be a string" unless my_alias.is_a?(String)
69
74
  end
70
75
  end
76
+
77
+ if @parent
78
+ if @parent.is_a? Parfait::Page
79
+ add_to_page(@parent)
80
+ else
81
+ if @parent.is_a? Parfait::Region
82
+ add_to_region(@parent)
83
+ else
84
+ raise "Parent specified for Region \"#{@name}\", but parent object type unrecognized."
85
+ end
86
+ end
87
+ end
88
+
71
89
  super
72
90
  end
73
91
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parfait
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Rotter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest