Class: Jekyll::HackclubChannelTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::HackclubChannelTag
- Defined in:
- lib/tags/channel-tag.rb
Instance Method Summary collapse
-
#initialize(tagName, content, tokens) ⇒ HackclubChannelTag
constructor
A new instance of HackclubChannelTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tagName, content, tokens) ⇒ HackclubChannelTag
Returns a new instance of HackclubChannelTag.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tags/channel-tag.rb', line 6 def initialize(tagName, content, tokens) super content = content.strip() @id, keys, pipes = ArgsParser.split_args(content) pipes = pipes || "" keys = keys.split(".") @data = HackclubRequest.raw_channel(@id).dig("channel").dig(*keys) @data = ArgsParser.eval_pipes_with_val(@data, pipes.split(" | ").map(&:strip)) end |
Instance Method Details
#render(context) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/tags/channel-tag.rb', line 17 def render(context) if @data == nil %Q{null} else %Q{#{@data}} end end |