Module: MinimalTags

Defined in:
lib/minimal_tags.rb,
lib/minimal_tags/version.rb,
lib/minimal_tags/simple_formatter.rb,
lib/minimal_tags/persistence/sequel.rb,
lib/minimal_tags/persistence/mongoid.rb,
lib/minimal_tags/persistence/activerecord.rb

Defined Under Namespace

Modules: ClassMethods, Persistence Classes: SimpleFormatter

Constant Summary collapse

VERSION =
'0.2.9'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_formatterObject



25
26
27
# File 'lib/minimal_tags.rb', line 25

def default_formatter
  @default_formatter ||= SimpleFormatter.new
end

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/minimal_tags.rb', line 8

def included(base)
  ancestors = base.ancestors.collect(&:to_s)
  base.send :extend, ClassMethods

  if ancestors.include?('Mongoid::Document')
    require 'minimal_tags/persistence/mongoid'
    base.send :extend, Persistence::Mongoid
  elsif ancestors.include?('ActiveRecord::Base')
    require 'minimal_tags/persistence/activerecord'
    base.send :extend, Persistence::Activerecord
  elsif ancestors.include?('Sequel::Model')
    require 'minimal_tags/persistence/sequel'
    base.plugin :hook_class_methods
    base.send :extend, Persistence::Sequel
  end
end