Class: MdlSearch::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/mdl_search/updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUpdater

Returns a new instance of Updater.



4
5
6
# File 'lib/mdl_search/updater.rb', line 4

def initialize
  @searcher = Searcher.new
end

Instance Attribute Details

#searcher=(value) ⇒ Object (writeonly)

Sets the attribute searcher

Parameters:

  • value

    the value to set the attribute searcher to.



3
4
5
# File 'lib/mdl_search/updater.rb', line 3

def searcher=(value)
  @searcher = value
end

Instance Method Details

#groups_from_yamlObject



24
25
26
# File 'lib/mdl_search/updater.rb', line 24

def groups_from_yaml
  YAML.load(File.read(File.expand_path('./yaml/groups.yml')))
end

#update_groups_yamlObject



16
17
18
19
20
21
22
# File 'lib/mdl_search/updater.rb', line 16

def update_groups_yaml
  file_path = File.expand_path('../../../yaml/groups.yml', __FILE__)
  File.open(file_path, 'w') do |file|
    file.write @searcher.groups_as_yaml
  end
  puts 'complete updating groups yaml file... plz check it.'
end

#update_icons_yamlObject



8
9
10
11
12
13
14
# File 'lib/mdl_search/updater.rb', line 8

def update_icons_yaml
  file_path = File.expand_path('../../../yaml/icons.yml', __FILE__)
  File.open(file_path, 'w') do |file|
    file.write @searcher.icons_as_yaml
  end
  puts 'complete updating icons yaml file... plz check it.'
end