Class: Hypermicrodata::SubmitButton

Inherits:
Property
  • Object
show all
Defined in:
lib/hypermicrodata/submit_button.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Property

#item?

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(button, form)
  @button = button
  @form = form.dup
  @excluded_fields = {}
  setup!
end

Instance Attribute Details

#formObject (readonly)

Returns the value of attribute form.



3
4
5
# File 'lib/hypermicrodata/submit_button.rb', line 3

def form
  @form
end

#methodObject (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_urlObject



16
17
18
# File 'lib/hypermicrodata/submit_button.rb', line 16

def action_url
  @form.action
end

#itemObject



37
38
39
# File 'lib/hypermicrodata/submit_button.rb', line 37

def item
  nil
end

#link?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/hypermicrodata/submit_button.rb', line 41

def link?
  true
end

#namesObject



28
29
30
# File 'lib/hypermicrodata/submit_button.rb', line 28

def names
  (node['itemprop'] || '').split(' ')
end

#nodeObject



49
50
51
# File 'lib/hypermicrodata/submit_button.rb', line 49

def node
  @button.node
end

#paramsObject



20
21
22
# File 'lib/hypermicrodata/submit_button.rb', line 20

def params
  @form.build_query
end

#query_stringObject



24
25
26
# File 'lib/hypermicrodata/submit_button.rb', line 24

def query_string
  build_query_string(params)
end

#relsObject



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

Returns:

  • (Boolean)


45
46
47
# File 'lib/hypermicrodata/submit_button.rb', line 45

def submit_button?
  true
end

#valueObject



12
13
14
# File 'lib/hypermicrodata/submit_button.rb', line 12

def value
  "#{action_url}?#{query_string}"
end