Class: PrismChecker::ElementWrapper
- Inherits:
-
Object
- Object
- PrismChecker::ElementWrapper
show all
- Defined in:
- lib/prism_checker/element_wrapper.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ElementWrapper.
7
8
9
|
# File 'lib/prism_checker/element_wrapper.rb', line 7
def initialize(element)
@element = element
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/prism_checker/element_wrapper.rb', line 35
def method_missing(method, *args)
if @element.respond_to?(method)
return @element.send(method, *args)
end
ret = @element[method]
if ret.nil? && !method.start_with?('data-')
raise NoMethodError, "unknown attribute '#{method}'"
end
ret
end
|
Instance Method Details
#checked ⇒ Object
15
16
17
|
# File 'lib/prism_checker/element_wrapper.rb', line 15
def checked
@element.checked?
end
|
#class ⇒ Object
11
12
13
|
# File 'lib/prism_checker/element_wrapper.rb', line 11
def class
@element[:class]
end
|
#disabled ⇒ Object
19
20
21
|
# File 'lib/prism_checker/element_wrapper.rb', line 19
def disabled
@element.disabled?
end
|
#multiple ⇒ Object
23
24
25
|
# File 'lib/prism_checker/element_wrapper.rb', line 23
def multiple
@element.multiple?
end
|
#readonly ⇒ Object
27
28
29
|
# File 'lib/prism_checker/element_wrapper.rb', line 27
def readonly
@element.readonly?
end
|
#respond_to_missing?(*_args) ⇒ Boolean
55
56
57
|
# File 'lib/prism_checker/element_wrapper.rb', line 55
def respond_to_missing?(*_args)
true
end
|
#selected ⇒ Object
31
32
33
|
# File 'lib/prism_checker/element_wrapper.rb', line 31
def selected
@element.selected?
end
|