class Piwik
Constants
- DOMAINPATH_RE
domain name (characters separated by a dot), optional port, optional URI path, no slash
- SETUP_CODE
- SITEID_RE
numeric ID
Public Class Methods
new(config)
click to toggle source
# File lib/analytics/Piwik.rb, line 26 def initialize(config) if !(DOMAINPATH_RE.match(config['url'])) raise ArgumentError, 'Invalid url. Must be a domain name, optionally followed by an URI path, no trailing slash (e.g. piwik.example.com or my.piwik.server/path)' end if !(SITEID_RE.match(config['siteId'])) raise ArgumentError, 'Invalid site id. Must be a number.' end @config = Hash[config.map{ |k, v| [k.to_sym, v.to_s] }] end
Public Instance Methods
render()
click to toggle source
# File lib/analytics/Piwik.rb, line 40 def render return SETUP_CODE % @config end