Module: Boffin
- Defined in:
- lib/boffin.rb,
lib/boffin/hit.rb,
lib/boffin/utils.rb,
lib/boffin/config.rb,
lib/boffin/tracker.rb,
lib/boffin/version.rb,
lib/boffin/keyspace.rb,
lib/boffin/trackable.rb
Overview
Boffin is a library for tracking hits to things in your Ruby application. Things can be IDs of records in a database, strings representing tags or topics, URLs of webpages, names of places, whatever you desire. Boffin is able to provide lists of those things based on most hits, least hits, it can even report on weighted combinations of different types of hits.
Refer to the README for further information and examples.
Defined Under Namespace
Modules: Trackable, Utils Classes: Config, Hit, Keyspace, Tracker, UndefinedHitTypeError
Constant Summary collapse
- NIL_SESSION_MEMBER =
The member to use when no session identifier is available for unique hit tracking
'boffin:nilsession'
- INTERVAL_FORMATS =
The way Time should be formatted for each interval type
{ :hours => '%F-%H', :days => '%F', :months => '%Y-%m' }
- INTERVAL_TYPES =
Different interval types
INTERVAL_FORMATS.keys
- VERSION =
Version of this Boffin release
'1.0.0'
Class Method Summary collapse
-
.config(opts = {}) {|Config.new| ... } ⇒ Config
Set or get the default Config instance.
-
.track(class_or_ns, hit_types = []) ⇒ Tracker
Creates a new Tracker instance.
Class Method Details
.config(opts = {}) {|Config.new| ... } ⇒ Config
Set or get the default Config instance
52 53 54 |
# File 'lib/boffin.rb', line 52 def self.config(opts = {}, &block) @config ||= Config.new(opts, &block) end |
.track(class_or_ns, hit_types = []) ⇒ Tracker
Creates a new Tracker instance. If passed a class, Trackable is injected into it.
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/boffin.rb', line 76 def self.track(class_or_ns, hit_types = []) case class_or_ns when String, Symbol Tracker.new(class_or_ns, hit_types) else class_or_ns.send(:include, Trackable) class_or_ns.boffin.hit_types = hit_types class_or_ns.boffin end end |