Class: Jekyll::HackclubUserTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::HackclubUserTag
- Defined in:
- lib/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.
6 7 8 9 10 11 12 |
# File 'lib/user-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_user(@id).dig("user").dig(*keys) end |
Instance Method Details
#render(context) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/user-tag.rb', line 14 def render(context) if @data == nil %Q{null} else %Q{#{@data}} end end |