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