Class: CongressForms::Actions::Base
- Inherits:
-
Object
- Object
- CongressForms::Actions::Base
- Defined in:
- lib/congress_forms/actions.rb
Direct Known Subclasses
Check, Choose, ClickOn, FillIn, Find, Javascript, Select, Uncheck, Visit, Wait, Yield
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#required ⇒ Object
(also: #required?)
Returns the value of attribute required.
-
#selector ⇒ Object
Returns the value of attribute selector.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #escape_css_attribute(v) ⇒ Object
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
- #inspect ⇒ Object
- #max_length ⇒ Object
- #placeholder_value? ⇒ Boolean
- #select_options ⇒ Object
- #submit? ⇒ Boolean
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
31 32 33 34 35 36 |
# File 'lib/congress_forms/actions.rb', line 31 def initialize(params = {}) self.selector = params["selector"] self.value = params["value"] self. = params["options"] || {} self.required = !!params["required"] end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
28 29 30 |
# File 'lib/congress_forms/actions.rb', line 28 def @options end |
#required ⇒ Object Also known as: required?
Returns the value of attribute required.
28 29 30 |
# File 'lib/congress_forms/actions.rb', line 28 def required @required end |
#selector ⇒ Object
Returns the value of attribute selector.
28 29 30 |
# File 'lib/congress_forms/actions.rb', line 28 def selector @selector end |
#value ⇒ Object
Returns the value of attribute value.
28 29 30 |
# File 'lib/congress_forms/actions.rb', line 28 def value @value end |
Instance Method Details
#escape_css_attribute(v) ⇒ Object
50 51 52 |
# File 'lib/congress_forms/actions.rb', line 50 def escape_css_attribute(v) v.gsub('"', '\"') end |
#inspect ⇒ Object
58 59 60 61 62 |
# File 'lib/congress_forms/actions.rb', line 58 def inspect s = "#{self.class.name.sub(/^CongressForms::Actions::/, '')}(" s << "#{selector.inspect}, " unless selector.nil? s << value.inspect << ")" end |
#max_length ⇒ Object
38 39 40 |
# File 'lib/congress_forms/actions.rb', line 38 def max_length .is_a?(Hash) ? ["max_length"] : nil end |
#placeholder_value? ⇒ Boolean
46 47 48 |
# File 'lib/congress_forms/actions.rb', line 46 def placeholder_value? value[0, 1] == "$" end |
#select_options ⇒ Object
42 43 44 |
# File 'lib/congress_forms/actions.rb', line 42 def [Choose, Select].include?(self.class) ? : nil end |
#submit? ⇒ Boolean
54 55 56 |
# File 'lib/congress_forms/actions.rb', line 54 def submit? "#{value} #{selector}".match(/submit/i) end |