Class: Riddler::Elements::Link
Instance Attribute Summary
#context, #definition
Class Method Summary
collapse
Instance Method Summary
collapse
for, inherited, #initialize, subclasses
#include?, #include_predicate
Class Method Details
.type ⇒ Object
4
5
6
|
# File 'lib/riddler/elements/link.rb', line 4
def self.type
"link"
end
|
Instance Method Details
#href ⇒ Object
8
9
10
|
# File 'lib/riddler/elements/link.rb', line 8
def href
@href ||= context.render definition["href"]
end
|
#link ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/riddler/elements/link.rb', line 12
def link
return href if context.variable(:interaction).nil?
"/interactions/%s/redirect?element_id=%s&url=%s" % [
context.interaction.id,
definition["id"],
href
]
end
|
#text ⇒ Object
21
22
23
|
# File 'lib/riddler/elements/link.rb', line 21
def text
context.render definition["text"]
end
|
#to_hash ⇒ Object
25
26
27
|
# File 'lib/riddler/elements/link.rb', line 25
def to_hash
super.merge text: text, href: href, link: link
end
|