Sha256: ebef6fee7f035feefb6cd2539bd142a281f11e0d7c058b6610db6e686a21d9e9

Contents?: true

Size: 937 Bytes

Versions: 1

Compression:

Stored size: 937 Bytes

Contents

require_relative "tagliani/configuration"
require_relative "tagliani/search"
require_relative "tagliani/version"
require_relative "tagliani/models"
require_relative "tagliani/concerns/taggable"
require_relative "tagliani/concerns/search"

require "byebug"
require "securerandom"
require "redis"

module Tagliani
  class Error < StandardError; end
  class << self
    attr_reader :config

    def configure
      @config ||= Configuration.new
      yield(@config)
    end

    def redis
      @redis ||= Redis.new(url: config.redis.url)
    end
  end

  def taggable(options = {})
    Models.tagged << to_s

    class_attribute :_tag_kls, :_async

    self._tag_kls = options[:tag_kls] || "Tag"
    self._async = options[:async]

    class_eval do
      include Concerns::Taggable
    end
  end
end

require "active_model/callbacks"
ActiveModel::Callbacks.include(Tagliani)

ActiveSupport.on_load(:active_record) do
  extend Tagliani
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tagliani-0.1.0 lib/tagliani.rb