Class: Jekyll::LeafletMarker

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-leaflet-mze/leaflet-items/leaflet-marker.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, input, tokens) ⇒ LeafletMarker

Returns a new instance of LeafletMarker.



7
8
9
10
11
12
13
14
# File 'lib/jekyll-leaflet-mze/leaflet-items/leaflet-marker.rb', line 7

def initialize(tag_name, input, tokens)
    super
    if input.empty?
        @input = '{}'
    else
        @input = input
    end
end

Instance Method Details

#render(context) ⇒ Object



16
17
18
19
20
21
# File 'lib/jekyll-leaflet-mze/leaflet-items/leaflet-marker.rb', line 16

def render(context)
    value = parse_liquid_output_in(@input, context)
    '{id: "' + SecureRandom.hex + '",
      type: "LeafletMarker",
      value: ' + value + '},'
end