Class: Juli::Visitor::Html::Helper::FbLike

Inherits:
AbstractHelper show all
Defined in:
lib/juli/visitor/html/helper/fb_like.rb

Overview

Helper-class for ‘fb_like’ helper

Constant Summary collapse

DEFAULT_TEMPLATE =

default HTML template for facebook ‘like’ button. You can customize it in .juli/config facebook.like.template entry.

%href in the template will be replaced to the actual URL of current wiki page.

'<fb:like href="%{href}" ' +
'send="false" layout="button_count" width="450" ' +
'show_faces="false">' +
'</fb:like>'

Instance Method Summary collapse

Methods inherited from AbstractHelper

conf_template, #set_conf_default

Methods included from Util

#camelize, conf, find_template, in_filename, juli_repo, mkdir, out_filename, str_limit, str_trim, to_wikiname, underscore, usage, visitor, visitor_list

Constructor Details

#initializeFbLike

Returns a new instance of FbLike.



15
16
17
# File 'lib/juli/visitor/html/helper/fb_like.rb', line 15

def initialize
  @fb_conf  = conf['facebook']
end

Instance Method Details

#on_root(in_file, root, visitor = nil) ⇒ Object

called on each parsed document



20
21
22
# File 'lib/juli/visitor/html/helper/fb_like.rb', line 20

def on_root(in_file, root, visitor = nil)
  @in_file  = in_file
end

#run(*args) ⇒ Object

Raises:



24
25
26
27
28
29
30
# File 'lib/juli/visitor/html/helper/fb_like.rb', line 24

def run(*args)
  raise Juli::NoConfig if !conf['url_prefix']
  raise Juli::NoConfig if !@in_file

  template.gsub('%{href}',
      conf['url_prefix'] + '/' + to_wikiname(@in_file) + conf['ext'])
end