Module: Tagliani

Defined in:
lib/tagliani.rb,
lib/tagliani/models.rb,
lib/tagliani/search.rb,
lib/tagliani/version.rb,
lib/tagliani/search/index.rb,
lib/tagliani/configuration.rb,
lib/tagliani/concerns/search.rb,
lib/tagliani/concerns/taggable.rb,
lib/tagliani/configuration/tag.rb,
lib/tagliani/configuration/redis.rb,
lib/tagliani/search/index/object.rb,
lib/tagliani/configuration/schema.rb,
lib/tagliani/concerns/taggable/tags.rb,
lib/tagliani/configuration/elasticsearch.rb

Defined Under Namespace

Modules: Concerns, Models Classes: Configuration, Error, Search

Constant Summary collapse

VERSION =
"0.1.1"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



15
16
17
# File 'lib/tagliani.rb', line 15

def config
  @config
end

Class Method Details

.configure {|@config| ... } ⇒ Object

Yields:



17
18
19
20
# File 'lib/tagliani.rb', line 17

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

.redisObject



22
23
24
# File 'lib/tagliani.rb', line 22

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

Instance Method Details

#taggable(options = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tagliani.rb', line 27

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

  class_attribute :_tag_kls, :_async, :_inherit

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

  class_eval do
    include Concerns::Taggable
  end
end