Class: Faun::Forum
Instance Attribute Summary collapse
#meta
Attributes inherited from Section
#id, #items, #name
Instance Method Summary
collapse
Methods inherited from Section
#each, #each_key, #each_value, #to_json
Constructor Details
#initialize(path) ⇒ Forum
Returns a new instance of Forum.
73
74
75
76
77
78
79
|
# File 'lib/faun.rb', line 73
def initialize(path)
super(0, nil, path, Topic)
@posts = @items.flat_map do |_, topic|
topic.posts.to_a
end.to_h
end
|
Instance Attribute Details
#posts ⇒ Object
Returns the value of attribute posts.
71
72
73
|
# File 'lib/faun.rb', line 71
def posts
@posts
end
|
Instance Method Details
#author_name(nick) ⇒ Object
81
82
83
|
# File 'lib/faun.rb', line 81
def author_name(nick)
@meta["authors"][nick] || nick
end
|
#item_name ⇒ Object
97
98
99
|
# File 'lib/faun.rb', line 97
def item_name
"topics"
end
|
#post(id) ⇒ Object
93
94
95
|
# File 'lib/faun.rb', line 93
def post(id)
@posts[id]
end
|
#subtopic(id, subid) ⇒ Object
89
90
91
|
# File 'lib/faun.rb', line 89
def subtopic(id, subid)
@items[id].subtopic(subid)
end
|
#topic(id) ⇒ Object
85
86
87
|
# File 'lib/faun.rb', line 85
def topic(id)
@items[id]
end
|