AXElements 7.0.0.pre2 → 7.0.0.pre3

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: bd138bd1918015d501ac413ebccac2cf9e1b0488
4
- data.tar.gz: 01ac16fafa2aa7326c19509e6dbeea9705d009c9
3
+ metadata.gz: 5dbc6cd5044cfd1d0d997fa1af18f723d298480b
4
+ data.tar.gz: 300b119742fa97600c3b2c79445e208f0321eba7
5
5
  SHA512:
6
- metadata.gz: db4c58ece919a38c609be6913a63b037af8279ccb93a7eb515e1ded2062ea1a23ee9aac7f4ccc6c802e07e95fa9cb62af894edf27408a82f764e2acf46b4fe6a
7
- data.tar.gz: b7a0bbfa490e132fce6eecc08e48f788ce561093560d5865b17e99f5d2a62cfa6a31731f6fe2ff10b0b9e3bfc84ac28ad2ea9d425f89ecf619e819b5a1adedaf
6
+ metadata.gz: b0773965241f98983ff4cd7941257b358e7d332d87e4a650ec9bfe8da716226201ff59ba02b46c365a0abaab4ae2ca694c1f75b3c479292759fbe872afab98ec
7
+ data.tar.gz: f1c8b184420efdc69da096d01a3c2027abf7ec589cfb5f36764ac343a76abefea8be1e993b1267e26dda5969a422a1b0a4adfe4b0688a3c4da8557f15bc87ceb
@@ -2,6 +2,7 @@
2
2
 
3
3
  * Compatibility with Yosemite (OS X 10.10)
4
4
  * Remove MacRuby support
5
+ * Allow other Array#method\_missing handlers to function (GH-9)
5
6
  * Update ActiveSupport dependency and
6
7
  - ActiveSupport 4.2.x is now required and all core extensions are loaded
7
8
 
@@ -172,11 +172,8 @@ you simply need to run the `test` task:
172
172
 
173
173
  __NOTE__: There may be some tests are dependent on Accessibility
174
174
  features that are new in OS X Lion which will cause test failures on
175
- OS X Snow Leopard. If you have any issues then you should look at the
176
- output to find hints at what went wrong and/or log a bug. AXElements
177
- will support Snow Leopard for as long as MacRuby does, but I do not
178
- have easy access to a Snow Leopard machine to verify that things still
179
- work.
175
+ OS X Snow Leopard. AXElements requires OS X versions with system Ruby
176
+ at version 2.0.0 or newer.
180
177
 
181
178
  ### Benchmarks
182
179
 
@@ -100,115 +100,40 @@ class << AX
100
100
  end
101
101
 
102
102
 
103
- if on_macruby?
103
+ ##
104
+ # `AXElements` extensions to the `Accessibility::Element` class
105
+ class Accessibility::Element
104
106
 
105
107
  ##
106
- # Extensions to {Accessibility::Element} for the higher level abstractions
108
+ # Override the default `#to_ruby` so that proper classes are
109
+ # chosen for each object.
107
110
  #
108
- # These extensions only make sense in the context of the high level API
109
- # but needs to be applied on the lower level class, so the code has been
110
- # placed in its own file.
111
- module Accessibility::Element
112
-
113
- ##
114
- # @todo Should we handle cases where a subrole has a value of
115
- # 'Unknown'? What is the performance impact?
116
- #
117
- # Wrap the low level wrapper with the appropriate high level wrapper.
118
- # This involves determining the proper class in the {AX} namespace,
119
- # possibly creating it on demand, and then instantiating the class to
120
- # wrap the low level object.
121
- #
122
- # Some code paths have been unrolled for efficiency. Don't hate player,
123
- # hate the game.
124
- #
125
- # @return [AX::Element]
126
- def to_ruby
127
- type = AXValueGetType(self)
128
- if type.zero?
129
- to_element
130
- else
131
- to_box type
132
- end
133
- end
134
-
135
-
136
- private
137
-
138
- ##
139
- # @private
140
- #
141
- # Reference to the singleton instance of the translator.
142
- #
143
- # @return [Accessibility::Translator]
144
- TRANSLATOR = Accessibility::Translator.instance
145
-
146
- def to_box type
147
- ptr = Pointer.new ValueWrapper::BOX_TYPES[type]
148
- AXValueGetValue(self, type, ptr)
149
- ptr.value.to_ruby
150
- end
151
-
152
- def to_element
153
- if roll = self.role
154
- roll = TRANSLATOR.unprefix roll
155
- if attributes.include? KAXSubroleAttribute
156
- subroll = self.subrole
157
- # Some objects claim to have a subrole but return nil
158
- if subroll
159
- AX.class_for2(TRANSLATOR.unprefix(subroll), roll).new self
160
- else
161
- AX.class_for(roll).new self
162
- end
111
+ # @return [AX::Element]
112
+ def to_ruby
113
+ if roll = self.role
114
+ roll = TRANSLATOR.unprefix roll
115
+ if attributes.include? KAXSubroleAttribute
116
+ subroll = self.subrole
117
+ # Some objects claim to have a subrole but return nil
118
+ if subroll
119
+ AX.class_for2(TRANSLATOR.unprefix(subroll), roll).new self
163
120
  else
164
121
  AX.class_for(roll).new self
165
122
  end
166
- else # failsafe in case object dies before we get the role
167
- AX::Element.new self
123
+ else
124
+ AX.class_for(roll).new self
168
125
  end
126
+ else # failsafe in case object dies before we get the role
127
+ AX::Element.new self
169
128
  end
170
-
171
129
  end
172
130
 
173
-
174
- else
175
-
176
-
177
131
  ##
178
- # `AXElements` extensions to the `Accessibility::Element` class
179
- class Accessibility::Element
180
-
181
- ##
182
- # Override the default `#to_ruby` so that proper classes are
183
- # chosen for each object.
184
- #
185
- # @return [AX::Element]
186
- def to_ruby
187
- if roll = self.role
188
- roll = TRANSLATOR.unprefix roll
189
- if attributes.include? KAXSubroleAttribute
190
- subroll = self.subrole
191
- # Some objects claim to have a subrole but return nil
192
- if subroll
193
- AX.class_for2(TRANSLATOR.unprefix(subroll), roll).new self
194
- else
195
- AX.class_for(roll).new self
196
- end
197
- else
198
- AX.class_for(roll).new self
199
- end
200
- else # failsafe in case object dies before we get the role
201
- AX::Element.new self
202
- end
203
- end
204
-
205
- ##
206
- # @private
207
- #
208
- # Reference to the singleton instance of the translator.
209
- #
210
- # @return [Accessibility::Translator]
211
- TRANSLATOR = Accessibility::Translator.instance
212
- end
213
-
132
+ # @private
133
+ #
134
+ # Reference to the singleton instance of the translator.
135
+ #
136
+ # @return [Accessibility::Translator]
137
+ TRANSLATOR = Accessibility::Translator.instance
214
138
  end
139
+
@@ -10,9 +10,6 @@ ActiveSupport::Inflector.inflections do |inflect|
10
10
  inflect.acronym('AMPM')
11
11
  end
12
12
 
13
- framework 'ApplicationServices' if on_macruby?
14
-
15
-
16
13
  ##
17
14
  # Maintain all the rules for transforming Cocoa constants into something
18
15
  # a little more Rubyish and taking the Rubyish symbols and translating
@@ -126,7 +123,7 @@ class Accessibility::Translator
126
123
  # @param name [#to_s]
127
124
  # @return [String]
128
125
  def guess_notification name
129
- name = name.to_s.gsub /(?:^|_)(.)/ do $1.upcase! || $1 end
126
+ name = name.to_s.gsub(/(?:^|_)(.)/) do $1.upcase! || $1 end
130
127
  const = "KAX#{name}Notification"
131
128
  Object.const_defined?(const) ? Object.const_get(const) : name
132
129
  end
@@ -4,7 +4,7 @@
4
4
  # The main AXElements namespace.
5
5
  module Accessibility
6
6
  # @return [String]
7
- VERSION = '7.0.0.pre2'
7
+ VERSION = '7.0.0.pre3'
8
8
 
9
9
  # @return [String]
10
10
  CODE_NAME = case RUBY_ENGINE
@@ -481,17 +481,11 @@ class AX::Element
481
481
  @ref.invalid?
482
482
  end
483
483
 
484
- if on_macruby?
485
- ##
486
- # Like {#respond_to?}, this is overriden to include attribute methods.
487
- # Though, it does include dynamic predicate methods at the moment.
488
- def methods include_super = true, include_objc_super = false
489
- super.concat(attributes).concat(parameterized_attributes)
490
- end
491
- else
492
- def methods include_super = true
493
- super.concat(attributes).concat(parameterized_attributes)
494
- end
484
+ ##
485
+ # Like {#respond_to?}, this is overriden to include attribute methods.
486
+ # Though, it does include dynamic predicate methods at the moment.
487
+ def methods include_super = true
488
+ super.concat(attributes).concat(parameterized_attributes)
495
489
  end
496
490
 
497
491
  ##
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'active_support/core_ext'
2
3
  require 'accessibility/bridge'
3
4
  require 'ax_elements/mri'
@@ -29,11 +29,13 @@ module Accessibility::ArrayCompatibility
29
29
  # outline.rows.text_fields.values # all at once
30
30
  #
31
31
  def method_missing method, *args
32
+ super unless first.kind_of?(AX::Element) ||
33
+ (empty? && method != :to_hash) # hack for GH-9
34
+
32
35
  smethod = TRANSLATOR.singularize(method.to_s.chomp('?'))
33
36
  map do |x|
34
- if !x.kind_of?(AX::Element) then super
35
- elsif x.respond_to? method then x.send method, *args
36
- else x.send smethod, *args
37
+ if x.respond_to? method then x.send method, *args
38
+ else x.send smethod, *args
37
39
  end
38
40
  end
39
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: AXElements
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0.pre2
4
+ version: 7.0.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rada
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: 1.3.1
175
175
  requirements: []
176
176
  rubyforge_project:
177
- rubygems_version: 2.4.5
177
+ rubygems_version: 2.4.3
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: UI Automation for OS X