Class: SwedbankPay::FieldTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- SwedbankPay::FieldTag
- Defined in:
- lib/field_tag.rb
Overview
Implements the ‘Level’ Liquid tag.
Instance Method Summary collapse
-
#initialize(tag_name, input, _) ⇒ FieldTag
constructor
A new instance of FieldTag.
- #render(_context) ⇒ Object
Constructor Details
#initialize(tag_name, input, _) ⇒ FieldTag
Returns a new instance of FieldTag.
7 8 9 10 11 |
# File 'lib/field_tag.rb', line 7 def initialize(tag_name, input, _) super (@field_name, @level) = parse_input(input) end |
Instance Method Details
#render(_context) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/field_tag.rb', line 13 def render(_context) return '' if @field_name.nil? || @field_name.empty? level_class = "field-level field-level-#{@level}" "<span class=\"#{level_class}\"><code class=\"language-json highlighter-rouge\">#{@field_name}</code></span>" end |