Class: Cocoadex::Element
Overview
A searchable element stored in the cache
Instance Attribute Summary collapse
Instance Method Summary
collapse
h3, inline_title, wrap
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
8
9
10
|
# File 'lib/cocoadex/models/element.rb', line 8
def name
@name
end
|
Instance Method Details
#<=>(other) ⇒ Object
21
22
23
|
# File 'lib/cocoadex/models/element.rb', line 21
def <=> other
name <=> other.name if other.respond_to? :name
end
|
#origin ⇒ Object
25
26
27
|
# File 'lib/cocoadex/models/element.rb', line 25
def origin
raise "#{self.class}#origin is not defined"
end
|
#parse_parameters(node) ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/cocoadex/models/element.rb', line 33
def parse_parameters node
node.css("dt").each do |param|
name_nodes = param.css("em")
if name_nodes.size > 0
name = param.css("em").first.text
description = param.next.css("p").first.text
parameters << Parameter.new(name, description)
end
end
end
|
#print ⇒ Object
14
15
16
17
18
19
|
# File 'lib/cocoadex/models/element.rb', line 14
def print
template_name = self.class.const_get("TEMPLATE_NAME")
path = Cocoadex.view_path(template_name)
template = IO.read(path, :mode => 'rb')
ERB.new(template, nil, '<>').result(binding)
end
|
#to_s ⇒ Object
10
11
12
|
# File 'lib/cocoadex/models/element.rb', line 10
def to_s
name
end
|
#type ⇒ Object
29
30
31
|
# File 'lib/cocoadex/models/element.rb', line 29
def type
raise "#{self.class}#type is not defined"
end
|