Module: Agenda

Defined in:
lib/agenda.rb,
lib/agenda/word.rb,
lib/agenda/version.rb,
lib/agenda/analyzer.rb,
lib/agenda/wordarray.rb

Defined Under Namespace

Classes: Analyzer, Word, WordArray

Constant Summary collapse

VERSION =
"0.1.4"
@@base_path =
File.dirname(File.dirname(File.expand_path(__FILE__)))
@@base_dictionary =
YAML.load_file "#{@@base_path}/config/dictionary.yaml"
@@dictionary =
{}
@@regexp =
YAML.load_file "#{@@base_path}/config/regexp.yaml"

Class Method Summary collapse

Class Method Details

.dictionaryObject



19
# File 'lib/agenda.rb', line 19

def self.dictionary; @@dictionary; end

.load_dictionaries_from(path) ⇒ Object



41
42
43
44
45
# File 'lib/agenda.rb', line 41

def self.load_dictionaries_from(path)
  Dir.new(path).each do |file|
    Agenda.load_dictionary "#{path}/#{file}" if file.end_with? "yaml"
  end
end

.load_dictionary(path) ⇒ Object



31
32
33
34
35
# File 'lib/agenda.rb', line 31

def self.load_dictionary(path)
  YAML.load_file(path).each do |key, value|
    @@dictionary[key.to_sym] = value
  end
end

.regexpObject



20
# File 'lib/agenda.rb', line 20

def self.regexp; @@regexp; end

.replace_dictionaries(path) ⇒ Object



47
48
49
50
# File 'lib/agenda.rb', line 47

def self.replace_dictionaries(path)
  @@dictionary = {}
  Agenda.load_dictionaries_from path
end

.replace_dictionaries_with(path) ⇒ Object



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

def self.replace_dictionaries_with(path)
  @@dictionary = {}
  Agenda.load_dictionary(path)
end

.reset_dictionariesObject



22
23
24
25
26
27
28
29
# File 'lib/agenda.rb', line 22

def self.reset_dictionaries
  @@dictionary = {}
  @@base_dictionary = YAML.load_file "#{@@base_path}/config/dictionary.yaml"
  @@dictionary = {}
  @@base_dictionary.each do |key, value|
    @@dictionary[key.to_sym] = value
  end
end