accessibility_core 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +0 -1
- data/History.markdown +7 -1
- data/Rakefile +1 -1
- data/lib/accessibility/core/macruby.rb +0 -3
- data/lib/accessibility/core/version.rb +6 -1
- data/lib/accessibility/core.rb +1 -1
- metadata +3 -6
- data/lib/accessibility/core/core_ext/common.rb +0 -57
- data/lib/accessibility/core/core_ext/macruby.rb +0 -140
- data/lib/accessibility/core/core_ext/mri.rb +0 -121
data/.yardopts
CHANGED
data/History.markdown
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# 0.
|
1
|
+
# 0.1.1 - Fix the silly things release
|
2
|
+
|
3
|
+
* Fix documentation not being generated
|
4
|
+
* Fix C extension not being installed to the proper location
|
5
|
+
* Remove redundant core extensions provided by `accessibility_bridge`
|
6
|
+
|
7
|
+
# 0.1.0 - Initial Release
|
2
8
|
|
3
9
|
* CRuby and MacRuby compatible
|
4
10
|
|
data/Rakefile
CHANGED
@@ -58,7 +58,7 @@ require 'rake/extensiontask'
|
|
58
58
|
|
59
59
|
Rake::ExtensionTask.new('core', SPEC) do |ext|
|
60
60
|
ext.ext_dir = 'ext/accessibility/core'
|
61
|
-
ext.lib_dir = 'lib/accessibility
|
61
|
+
ext.lib_dir = 'lib/accessibility'
|
62
62
|
end
|
63
63
|
|
64
64
|
#Rake::ExtensionTask.new('highlighter', SPEC) do |ext|
|
@@ -1,6 +1,11 @@
|
|
1
|
+
##
|
2
|
+
# Namespace for the various `accessibility` projects that are part
|
3
|
+
# of AXElements
|
1
4
|
module Accessibility
|
5
|
+
##
|
6
|
+
# Namespace for `accessibility_core` specific classes
|
2
7
|
module Core
|
3
8
|
# return [String]
|
4
|
-
VERSION = '0.1.
|
9
|
+
VERSION = '0.1.1'
|
5
10
|
end
|
6
11
|
end
|
data/lib/accessibility/core.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: accessibility_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -87,9 +87,6 @@ extensions:
|
|
87
87
|
- ext/accessibility/core/extconf.rb
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- lib/accessibility/core/core_ext/common.rb
|
91
|
-
- lib/accessibility/core/core_ext/macruby.rb
|
92
|
-
- lib/accessibility/core/core_ext/mri.rb
|
93
90
|
- lib/accessibility/core/macruby.rb
|
94
91
|
- lib/accessibility/core/version.rb
|
95
92
|
- lib/accessibility/core.rb
|
@@ -138,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
135
|
version: '0'
|
139
136
|
segments:
|
140
137
|
- 0
|
141
|
-
hash:
|
138
|
+
hash: 1998952382329667807
|
142
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
140
|
none: false
|
144
141
|
requirements:
|
@@ -147,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
144
|
version: '0'
|
148
145
|
segments:
|
149
146
|
- 0
|
150
|
-
hash:
|
147
|
+
hash: 1998952382329667807
|
151
148
|
requirements: []
|
152
149
|
rubyforge_project:
|
153
150
|
rubygems_version: 1.8.24
|
@@ -1,57 +0,0 @@
|
|
1
|
-
class CGPoint
|
2
|
-
##
|
3
|
-
# Returns the receiver, since the receiver is already a {CGPoint}
|
4
|
-
#
|
5
|
-
# @return [CGPoint]
|
6
|
-
def to_point
|
7
|
-
self
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class CGSize
|
12
|
-
##
|
13
|
-
# Returns the receiver, since the receiver is already a {CGSize}
|
14
|
-
#
|
15
|
-
# @return [CGSize]
|
16
|
-
def to_size
|
17
|
-
self
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class CGRect
|
22
|
-
##
|
23
|
-
# Returns the receiver, since the receiver is already a {CGRect}
|
24
|
-
#
|
25
|
-
# @return [CGRect]
|
26
|
-
def to_rect
|
27
|
-
self
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
##
|
32
|
-
# accessibility-core extensions to `Array`
|
33
|
-
class Array
|
34
|
-
##
|
35
|
-
# Coerce the first two elements of the receiver into a {CGPoint}
|
36
|
-
#
|
37
|
-
# @return [CGPoint]
|
38
|
-
def to_point
|
39
|
-
CGPoint.new self[0], self[1]
|
40
|
-
end
|
41
|
-
|
42
|
-
##
|
43
|
-
# Coerce the first two elements of the receiver into a {CGSize}
|
44
|
-
#
|
45
|
-
# @return [CGSize]
|
46
|
-
def to_size
|
47
|
-
CGSize.new self[0], self[1]
|
48
|
-
end
|
49
|
-
|
50
|
-
##
|
51
|
-
# Coerce the first four elements of the receiver into a {CGRect}
|
52
|
-
#
|
53
|
-
# @return [CGRect]
|
54
|
-
def to_rect
|
55
|
-
CGRect.new CGPoint.new(self[0], self[1]), CGSize.new(self[2], self[3])
|
56
|
-
end
|
57
|
-
end
|
@@ -1,140 +0,0 @@
|
|
1
|
-
require 'accessibility/core/core_ext/common'
|
2
|
-
|
3
|
-
##
|
4
|
-
# accessibility-core extensions for `NSURL`
|
5
|
-
class NSURL
|
6
|
-
##
|
7
|
-
# Return the reciver, for the receiver is already a URL object
|
8
|
-
#
|
9
|
-
# @return [NSURL]
|
10
|
-
def to_url
|
11
|
-
self
|
12
|
-
end
|
13
|
-
|
14
|
-
# because printing is easier this way
|
15
|
-
alias_method :to_s, :inspect
|
16
|
-
end
|
17
|
-
|
18
|
-
##
|
19
|
-
# accessibility-core extensions for `NSString`
|
20
|
-
class NSString
|
21
|
-
##
|
22
|
-
# Create an NSURL using the receiver as the initialization string
|
23
|
-
#
|
24
|
-
# If the receiver is not a valid URL then `nil` will be returned.
|
25
|
-
#
|
26
|
-
# This exists because of
|
27
|
-
# [rdar://11207662](http://openradar.appspot.com/11207662).
|
28
|
-
#
|
29
|
-
# @return [NSURL,nil]
|
30
|
-
def to_url
|
31
|
-
NSURL.URLWithString self
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
##
|
36
|
-
# `accessibility-core` extensions for `NSObject`
|
37
|
-
class NSObject
|
38
|
-
##
|
39
|
-
# Return an object safe for passing to AXAPI
|
40
|
-
def to_ax
|
41
|
-
self
|
42
|
-
end
|
43
|
-
|
44
|
-
##
|
45
|
-
# Return a usable object from an AXAPI pointer
|
46
|
-
def to_ruby
|
47
|
-
self
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# `accessibility-core` extensions for `CFRange`
|
53
|
-
class CFRange
|
54
|
-
##
|
55
|
-
# Convert the {CFRange} to a Ruby {Range} object
|
56
|
-
#
|
57
|
-
# @return [Range]
|
58
|
-
def to_ruby
|
59
|
-
Range.new location, (location + length - 1)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
##
|
64
|
-
# `accessibility-core` extensions for `Range`
|
65
|
-
class Range
|
66
|
-
# @return [AXValueRef]
|
67
|
-
def to_ax
|
68
|
-
raise ArgumentError, "can't convert negative index" if last < 0 || first < 0
|
69
|
-
length = if exclude_end?
|
70
|
-
last - first
|
71
|
-
else
|
72
|
-
last - first + 1
|
73
|
-
end
|
74
|
-
CFRange.new(first, length).to_ax
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
##
|
79
|
-
# AXElements extensions to the `Boxed` class
|
80
|
-
#
|
81
|
-
# The `Boxed` class is simply an abstract base class for structs that
|
82
|
-
# MacRuby can use via bridge support.
|
83
|
-
class Boxed
|
84
|
-
##
|
85
|
-
# Returns the number that AXAPI uses in order to know how to wrap
|
86
|
-
# a struct.
|
87
|
-
#
|
88
|
-
# @return [Number]
|
89
|
-
def self.ax_value
|
90
|
-
raise NotImplementedError, "#{inspect}:#{self.class} cannot be wrapped"
|
91
|
-
end
|
92
|
-
|
93
|
-
##
|
94
|
-
# Create an `AXValueRef` from the `Boxed` instance. This will only
|
95
|
-
# work if for the most common boxed types, you will need to check
|
96
|
-
# the AXAPI documentation for an up to date list.
|
97
|
-
#
|
98
|
-
# @example
|
99
|
-
#
|
100
|
-
# CGPoint.new(12, 34).to_ax # => #<AXValueRef:0x455678e2>
|
101
|
-
# CGSize.new(56, 78).to_ax # => #<AXValueRef:0x555678e2>
|
102
|
-
#
|
103
|
-
# @return [AXValueRef]
|
104
|
-
def to_ax
|
105
|
-
klass = self.class
|
106
|
-
ptr = Pointer.new klass.type
|
107
|
-
ptr.assign self
|
108
|
-
AXValueCreate(klass.ax_value, ptr)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# `accessibility-core` extensions for `CFRange`'s metaclass
|
113
|
-
class << CFRange
|
114
|
-
# (see Boxed.ax_value)
|
115
|
-
def ax_value; KAXValueCFRangeType end
|
116
|
-
end
|
117
|
-
# `accessibility-core` extensions for `CGSize`'s metaclass
|
118
|
-
class << CGSize
|
119
|
-
# (see Boxed.ax_value)
|
120
|
-
def ax_value; KAXValueCGSizeType end
|
121
|
-
end
|
122
|
-
# `accessibility-core` extensions for `CGRect`'s metaclass
|
123
|
-
class << CGRect
|
124
|
-
# (see Boxed.ax_value)
|
125
|
-
def ax_value; KAXValueCGRectType end
|
126
|
-
end
|
127
|
-
# `accessibility-core` extensions for `CGPoint`'s metaclass
|
128
|
-
class << CGPoint
|
129
|
-
# (see Boxed.ax_value)
|
130
|
-
def ax_value; KAXValueCGPointType end
|
131
|
-
end
|
132
|
-
|
133
|
-
##
|
134
|
-
# `accessibility-core` extensions to `NSArray`
|
135
|
-
class NSArray
|
136
|
-
# @return [Array]
|
137
|
-
def to_ruby
|
138
|
-
map do |obj| obj.to_ruby end
|
139
|
-
end
|
140
|
-
end
|
@@ -1,121 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# A structure that contains a point in a two-dimensional coordinate system
|
3
|
-
CGPoint = Struct.new(:x, :y) do
|
4
|
-
|
5
|
-
# @param x [Number]
|
6
|
-
# @param y [Number]
|
7
|
-
def initialize x = 0.0, y = 0.0
|
8
|
-
super
|
9
|
-
end
|
10
|
-
|
11
|
-
# @!attribute [rw] x
|
12
|
-
# The `x` co-ordinate of the screen point
|
13
|
-
# @return [Number]
|
14
|
-
|
15
|
-
# @!attribute [rw] y
|
16
|
-
# The `y` co-ordinate of the screen point
|
17
|
-
# @return [Number]
|
18
|
-
|
19
|
-
##
|
20
|
-
# Return a nice string representation of the point
|
21
|
-
#
|
22
|
-
# Overrides `Object#inspect` to more closely mimic MacRuby `Boxed#inspect`.
|
23
|
-
#
|
24
|
-
# @return [String]
|
25
|
-
def inspect
|
26
|
-
"#<CGPoint x=#{self.x.to_f} y=#{self.y.to_f}>"
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
##
|
33
|
-
# A structure that contains the size of a rectangle in a 2D co-ordinate system
|
34
|
-
CGSize = Struct.new(:width, :height) do
|
35
|
-
|
36
|
-
# @param width [Number]
|
37
|
-
# @param height [Number]
|
38
|
-
def initialize width = 0.0, height = 0.0
|
39
|
-
super
|
40
|
-
end
|
41
|
-
|
42
|
-
# @!attribute [rw] width
|
43
|
-
# The `width` of the box
|
44
|
-
# @return [Number]
|
45
|
-
|
46
|
-
# @!attribute [rw] height
|
47
|
-
# The `heighth` of the box
|
48
|
-
# @return [Number]
|
49
|
-
|
50
|
-
##
|
51
|
-
# Return a nice string representation of the size
|
52
|
-
#
|
53
|
-
# Overrides `Object#inspect` to more closely mimic MacRuby `Boxed#inspect`.
|
54
|
-
#
|
55
|
-
# @return [String]
|
56
|
-
def inspect
|
57
|
-
"#<CGSize width=#{self.width.to_f} height=#{self.height.to_f}>"
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
##
|
64
|
-
# Complete definition of a rectangle in a 2D coordinate system
|
65
|
-
CGRect = Struct.new(:origin, :size) do
|
66
|
-
|
67
|
-
# @param origin [CGPoint,#to_point]
|
68
|
-
# @param size [CGSize,#to_size]
|
69
|
-
def initialize origin = CGPoint.new, size = CGSize.new
|
70
|
-
super(origin.to_point, size.to_size)
|
71
|
-
end
|
72
|
-
|
73
|
-
# @!attribute [rw] origin
|
74
|
-
# The `origin` point
|
75
|
-
# @return [CGPoint,#to_point]
|
76
|
-
|
77
|
-
# @!attribute [rw] size
|
78
|
-
# The `size` of the rectangle
|
79
|
-
# @return [CGSize,#to_size]
|
80
|
-
|
81
|
-
##
|
82
|
-
# Return a nice string representation of the rectangle
|
83
|
-
#
|
84
|
-
# Overrides `Object#inspect` to more closely mimic MacRuby `Boxed#inspect`.
|
85
|
-
#
|
86
|
-
# @return [String]
|
87
|
-
def inspect
|
88
|
-
"#<CGRect origin=#{self.origin.inspect} size=#{self.size.inspect}>"
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
require 'uri'
|
95
|
-
|
96
|
-
##
|
97
|
-
# `accessibility-core` extensions to the `URI` family of classes
|
98
|
-
class URI::Generic
|
99
|
-
##
|
100
|
-
# Returns the receiver (since the receiver is already a `URI` object)
|
101
|
-
#
|
102
|
-
# @return [URI::Generic]
|
103
|
-
def to_url
|
104
|
-
self
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
##
|
109
|
-
# `accessibility-core` extensions to the `String` class
|
110
|
-
class String
|
111
|
-
##
|
112
|
-
# Parse the receiver into a `URI` object
|
113
|
-
#
|
114
|
-
# @return [URI::Generic]
|
115
|
-
def to_url
|
116
|
-
URI.parse self
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
|
121
|
-
require 'accessibility/core/core_ext/common'
|