Class: Jekyll::HackclubChannelTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/channel-tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(tagName, content, tokens) ⇒ HackclubChannelTag

Returns a new instance of HackclubChannelTag.



6
7
8
9
10
11
12
# File 'lib/channel-tag.rb', line 6

def initialize(tagName, content, tokens)
    super
    content = content.strip()
    @id, *rest = content.split(" ", 2)
    keys = rest.join.split(".")
    @data = HackclubRequest.raw_channel(@id).dig("channel").dig(*keys)
end

Instance Method Details

#render(context) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/channel-tag.rb', line 14

def render(context)
    if @data == nil
        %Q{null}
    else
        %Q{#{@data}}
    end
end