Class: Glossarist::DetailedDefinition
- Inherits:
-
Model
- Object
- Model
- Glossarist::DetailedDefinition
show all
- Defined in:
- lib/glossarist/detailed_definition.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Model
from_h, new, #set_attribute
Constructor Details
Returns a new instance of DetailedDefinition.
6
7
8
9
10
11
12
|
# File 'lib/glossarist/detailed_definition.rb', line 6
def initialize(attributes = {})
if attributes.is_a?(Hash)
super
else
self.content = attributes
end
end
|
Instance Attribute Details
#content ⇒ String
15
16
17
|
# File 'lib/glossarist/detailed_definition.rb', line 15
def content
@content
end
|
18
19
20
|
# File 'lib/glossarist/detailed_definition.rb', line 18
def sources
@sources
end
|
Instance Method Details
#to_h ⇒ Object
24
25
26
27
28
29
|
# File 'lib/glossarist/detailed_definition.rb', line 24
def to_h
{
"content" => content,
"sources" => sources&.map(&:to_h),
}.compact
end
|