Class: Jekyll::Simple::Tab::TabsBlock

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/jekyll-simple-tab.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag, args, _) ⇒ TabsBlock

Returns a new instance of TabsBlock.

Raises:

  • (SyntaxError)


9
10
11
12
13
14
15
# File 'lib/jekyll-simple-tab.rb', line 9

def initialize(tag, args, _)
  super

  raise SyntaxError.new("#{tag} requires name") if args.empty?

  @tab_name = args.strip
end

Instance Method Details

#render(context) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/jekyll-simple-tab.rb', line 22

def render(context)
  @environment = context.environments.first
  super

  templateFilePath = template_path(DEFAULT_TEMPLATE)
  template = Slim::Template.new(templateFilePath)
  template.render(self)
end

#template_path(template_name) ⇒ Object



17
18
19
20
# File 'lib/jekyll-simple-tab.rb', line 17

def template_path(template_name)
  dir = File.dirname(__FILE__)
  File.join(dir, template_name.to_s)
end