Module: StringReaderWriterMixin
- Included in:
- Text
- Defined in:
- lib/rutl/interface/elements/string_reader_writer_mixin.rb
Overview
Implement String stuff in a mixin. TODO: Not finished yet. Must be able to
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 48
def method_missing(method, *args, &block)
super unless get.respond_to?(method)
if args.empty?
get.send(method)
else
get.send(method, *args, &block)
end
end
|
Instance Method Details
#clear ⇒ Object
33
34
35
36
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 33
def clear
this_css.clear
get
end
|
#eql?(other) ⇒ Boolean
Also known as:
==
38
39
40
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 38
def eql?(other)
other == get
end
|
#get ⇒ Object
Also known as:
text, value, to_s
26
27
28
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 26
def get
this_css.attribute(:value)
end
|
#initialize(element_context, input_value = nil) ⇒ Object
Override BaseElement’s normal initialize method.
7
8
9
10
11
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 7
def initialize(element_context, input_value = nil)
raise element_context.to_s unless element_context.is_a? ElementContext
@context = element_context
set input_value unless input_value.nil?
end
|
#respond_to_missing?(method, flag) ⇒ Boolean
59
60
61
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 59
def respond_to_missing?(method, flag)
get.respond_to?(method, flag)
end
|
#send_keys(string) ⇒ Object
43
44
45
46
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 43
def send_keys(string)
this_css.send_keys(string)
get
end
|
#set(string) ⇒ Object
Also known as:
text=, value=
I could cut set() and only foo_text= if I change this. The problem I’m running into is not having the driver in base element to do this_css calls. So I have to change the way drivers are passed into everything or initially have them everywhere, which means rewriting chosen drivers or changing page load. Ick.
19
20
21
22
|
# File 'lib/rutl/interface/elements/string_reader_writer_mixin.rb', line 19
def set(string)
clear
this_css.send_keys(string)
end
|