We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca0007a commit a72fc5bCopy full SHA for a72fc5b
1 file changed
lib/baseballbot/templates/sidebar.rb
@@ -6,6 +6,25 @@ class Sidebar < Template
6
include Sidebars::Components
7
8
def inspect = %(#<#{self.class.name} @subreddit="#{@subreddit.name}">)
9
+
10
+ def evaluated_body
11
+ return super unless @blocks && !@blocks.empty?
12
13
+ @blocks
14
+ .map { block_for(it) }
15
+ .join("\n\n")
16
+ end
17
18
+ def block_for(block)
19
+ case block['type']
20
+ when 'division_standings'
21
+ Blocks::DivisionStandings.new(subreddit, template: self, **block).render
22
+ when 'calendar'
23
+ Blocks::Calendar.new(subreddit, template: self, **block).render
24
+ else
25
+ block['content']
26
27
28
end
29
30
0 commit comments