Class: NSObject

Inherits:
Object show all
Defined in:
lib/project/object.rb,
lib/motion-accessibility-console/object.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.method_added(name) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/project/object.rb', line 72

def self.method_added(name)
if self.respond_to?(:method_added_motion_accessibility)
self.method_added_motion_accessibility(name)
end
return if name=~/=$/
attributes=Accessibility::All_Attributes
return unless attributes.flatten.include?(name.to_sym)
if attributes.has_key?(name)
ruby=name
ios=attributes[name]
define_method(ios) {self.send(ruby)}
else
ios=name
ruby=attributes.rassoc(name).first
define_method(ruby) { self.send(ios)}
end
Accessibility.defined_attribute(self,ios)
end

.method_added_motion_accessibilityObject



67
# File 'lib/project/object.rb', line 67

alias :method_added_motion_accessibility :method_added

Instance Method Details

#accessibility_traits=(traits) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/project/object.rb', line 38

def accessibility_traits=(traits)
bits=0
if traits.kind_of?(Fixnum)
bits=traits
elsif traits.kind_of?(Symbol)
bits=traits.accessibility_trait
elsif traits.kind_of?(Array)
traits.each {|trait| bits|=trait.accessibility_trait}
else
raise "Pass a bitmask, a symbol, or an array to accessibility_traits="
end
self.accessibilityTraits=bits
self
end

#browse(*args) ⇒ Object Also known as: b



3
4
5
# File 'lib/motion-accessibility-console/object.rb', line 3

def browse(*args)
A11y::Console.browse(*args)
end

#inspect_accessibility_traitsObject



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/project/object.rb', line 53

def inspect_accessibility_traits
traits=[]
Accessibility::Traits.each do |trait, bitmask|
if self.accessibility_traits&bitmask>0
name=trait.gsub(/_/,' ').capitalize
traits<<name
end
end
traits=["None"] if traits.empty?
  traits.join(', ')
end

#touch(*args) ⇒ Object



9
10
11
# File 'lib/motion-accessibility-console/object.rb', line 9

def touch(*args)
A11y::Console.touch(*args)
end

#view(*args) ⇒ Object Also known as: v



6
7
8
# File 'lib/motion-accessibility-console/object.rb', line 6

def view(*args)
A11y::Console.view(*args)
end