Class: PufferPages::Liquid::PageDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/puffer_pages/liquid/page_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ PageDrop

Returns a new instance of PageDrop.



8
9
10
# File 'lib/puffer_pages/liquid/page_drop.rb', line 8

def initialize page
  @page = page
end

Instance Method Details

#==(other) ⇒ Object



40
41
42
# File 'lib/puffer_pages/liquid/page_drop.rb', line 40

def == other
  page == other.send(:page)
end

#ancestor?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/puffer_pages/liquid/page_drop.rb', line 36

def ancestor?
  current_page && page.is_ancestor_of?(current_page)
end

#before_method(name) ⇒ Object



44
45
46
47
# File 'lib/puffer_pages/liquid/page_drop.rb', line 44

def before_method name
  page_part = page.inherited_page_part(name)
  page_part.handle(@context) if page_part && @context
end

#current?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/puffer_pages/liquid/page_drop.rb', line 32

def current?
  current_page && page == current_page
end

#nameObject



12
13
14
# File 'lib/puffer_pages/liquid/page_drop.rb', line 12

def name
  @context ? page.render(page.name, @context) : page.name
end

#pathObject



24
25
26
# File 'lib/puffer_pages/liquid/page_drop.rb', line 24

def path
  controller.puffer_pages.puffer_page_path page.to_location
end

#urlObject



28
29
30
# File 'lib/puffer_pages/liquid/page_drop.rb', line 28

def url
  controller.puffer_pages.puffer_page_url page.to_location
end