Class: Hypermicrodata::SubmitButton
- Defined in:
- lib/hypermicrodata/submit_button.rb
Instance Attribute Summary collapse
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #action_url ⇒ Object
-
#initialize(button, form) ⇒ SubmitButton
constructor
A new instance of SubmitButton.
- #item ⇒ Object
- #link? ⇒ Boolean
- #names ⇒ Object
- #node ⇒ Object
- #params ⇒ Object
- #query_string ⇒ Object
- #rels ⇒ Object
- #submit_button? ⇒ Boolean
- #value ⇒ Object
Methods inherited from Property
Constructor Details
#initialize(button, form) ⇒ SubmitButton
Returns a new instance of SubmitButton.
5 6 7 8 9 10 |
# File 'lib/hypermicrodata/submit_button.rb', line 5 def initialize(, form) @button = @form = form.dup @excluded_fields = {} setup! end |
Instance Attribute Details
#form ⇒ Object (readonly)
Returns the value of attribute form.
3 4 5 |
# File 'lib/hypermicrodata/submit_button.rb', line 3 def form @form end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
3 4 5 |
# File 'lib/hypermicrodata/submit_button.rb', line 3 def method @method end |
Instance Method Details
#action_url ⇒ Object
16 17 18 |
# File 'lib/hypermicrodata/submit_button.rb', line 16 def action_url @form.action end |
#item ⇒ Object
37 38 39 |
# File 'lib/hypermicrodata/submit_button.rb', line 37 def item nil end |
#link? ⇒ Boolean
41 42 43 |
# File 'lib/hypermicrodata/submit_button.rb', line 41 def link? true end |
#names ⇒ Object
28 29 30 |
# File 'lib/hypermicrodata/submit_button.rb', line 28 def names (node['itemprop'] || '').split(' ') end |
#node ⇒ Object
49 50 51 |
# File 'lib/hypermicrodata/submit_button.rb', line 49 def node @button.node end |
#params ⇒ Object
20 21 22 |
# File 'lib/hypermicrodata/submit_button.rb', line 20 def params @form.build_query end |
#query_string ⇒ Object
24 25 26 |
# File 'lib/hypermicrodata/submit_button.rb', line 24 def query_string build_query_string(params) end |
#rels ⇒ Object
32 33 34 35 |
# File 'lib/hypermicrodata/submit_button.rb', line 32 def rels rel = (node['rel'] || node['data-rel'] || @button.dom_class || '') rel.split(' ') end |
#submit_button? ⇒ Boolean
45 46 47 |
# File 'lib/hypermicrodata/submit_button.rb', line 45 def true end |
#value ⇒ Object
12 13 14 |
# File 'lib/hypermicrodata/submit_button.rb', line 12 def value "#{action_url}?#{query_string}" end |