Class: Octopress::Debugger::Tag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/octopress-debugger.rb

Instance Method Summary collapse

Instance Method Details

#c(var = nil) ⇒ Object



37
38
39
# File 'lib/octopress-debugger.rb', line 37

def c(var=nil)
  var.nil? ? @context : @context[var]
end

#page ⇒ Object



45
46
47
# File 'lib/octopress-debugger.rb', line 45

def page
  @page ||= site.pages.find{|p| p.url == c('page')['url'] }
end

#render(context) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/octopress-debugger.rb', line 13

def render(context)
  @context = context

  # HELP: How does this work?
  #
  # Try these commands:
  #  site   => Jekyll's Site instance
  #  page   => Current Page instance
  #  scopes => View local variable scopes
  #
  # Use `c` to read variables from Liquid's context 
  #  c 'site' => site hash
  #  c 'page' => page hash
  #
  # Dot notation works too:
  #  c 'site.posts.first'
  #  c 'page.content'
  #  c 'post.tags'

  binding.pry

  return '' # Debugger halts on this line
end

#scopes ⇒ Object



49
50
51
# File 'lib/octopress-debugger.rb', line 49

def scopes
  @context.scopes
end

#site ⇒ Object



41
42
43
# File 'lib/octopress-debugger.rb', line 41

def site
  site = @context.registers[:site]
end