Module: Capybara::UI::WidgetParts::Struct::ClassMethods
- Defined in:
- lib/capybara/ui/widgets/parts/struct.rb
Instance Method Summary collapse
- #attribute(name, selector, &block) ⇒ Object
- #boolean(name, selector, &block) ⇒ Object
- #date(name, selector, &block) ⇒ Object
- #float(name, selector, &block) ⇒ Object
- #integer(name, selector, &block) ⇒ Object
- #list(name, selector, options = {}, &block) ⇒ Object
- #string(name, *args, &block) ⇒ Object
- #time(name, *args, &block) ⇒ Object
Instance Method Details
#attribute(name, selector, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 10 def attribute(name, selector, &block) child = (name, selector, &block) class_eval <<-WIDGET def #{name} widget(:#{name}).value end WIDGET child end |
#boolean(name, selector, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 22 def boolean(name, selector, &block) child = (name, selector, &block) class_eval <<-WIDGET def #{name}? widget(:#{name}).value end WIDGET child.class_eval <<-VALUE def value Capybara::UI::Conversions::Boolean(text) end VALUE child end |
#date(name, selector, &block) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 40 def date(name, selector, &block) child = attribute(name, selector, &block) child.class_eval <<-VALUE def value Date.parse(text) end VALUE child end |
#float(name, selector, &block) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 52 def float(name, selector, &block) child = attribute(name, selector, &block) child.class_eval <<-VALUE def value Float(text) end VALUE child end |
#integer(name, selector, &block) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 64 def integer(name, selector, &block) child = attribute(name, selector, &block) child.class_eval <<-VALUE def value Integer(text) end VALUE child end |
#list(name, selector, options = {}, &block) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 76 def list(name, selector, = {}, &block) child = (name, selector, Capybara::UI::List) do item [:item_selector], [:item_class] || ListItem end class_eval <<-WIDGET def #{name} widget(:#{name}).value end WIDGET child.class_eval(&block) if block_given? child end |
#string(name, *args, &block) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 92 def string(name, *args, &block) child = attribute(name, *args, &block) child.class_eval <<-VALUE def value text end VALUE child end |
#time(name, *args, &block) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/capybara/ui/widgets/parts/struct.rb', line 104 def time(name, *args, &block) child = attribute(name, *args, &block) child.class_eval <<-VALUE def value Time.parse(text) end VALUE child end |