Module: Lunar

Defined in:
lib/lunar.rb,
lib/lunar/sets.rb,
lib/lunar/index.rb,
lib/lunar/words.rb,
lib/lunar/search.rb,
lib/lunar/scoring.rb,
lib/lunar/fuzzy_word.rb,
lib/lunar/result_set.rb

Defined Under Namespace

Modules: Sets Classes: FuzzySets, FuzzyWord, Index, KeywordSets, RangeSets, ResultSet, Scoring, Search, SortedResultSet, UnsortedResultSet, Words

Class Method Summary collapse

Class Method Details

.encode(str) ⇒ Object



32
33
34
# File 'lib/lunar.rb', line 32

def self.encode(str)
  Base64.encode64(str).strip 
end

.nestObject



36
37
38
# File 'lib/lunar.rb', line 36

def self.nest
  Nest.new(:Lunar)
end

.redis(connection = defined?(Ohm) ? Ohm.redis : nil) ⇒ Object



23
24
25
# File 'lib/lunar.rb', line 23

def self.redis(connection = defined?(Ohm) ? Ohm.redis : nil)
  @connection ||= connection 
end

.search(prefix, keywords, &block) ⇒ Object



27
28
29
30
# File 'lib/lunar.rb', line 27

def self.search(prefix, keywords, &block)
  search = Search.new(prefix, keywords)
  search.results(&block)
end

.ttlObject



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

def self.ttl
  @ttl ||= 30
end

.ttl=(ttl) ⇒ Object



19
20
21
# File 'lib/lunar.rb', line 19

def self.ttl=(ttl)
  @ttl = ttl
end