Class: Droonga::NodeStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/node_status.rb

Instance Method Summary collapse

Constructor Details

#initializeNodeStatus

Returns a new instance of NodeStatus.



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

def initialize
  reload
end

Instance Method Details

#delete(key) ⇒ Object



42
43
44
45
46
# File 'lib/droonga/node_status.rb', line 42

def delete(key)
  key = normalize_key(key)
  @status.delete(key)
  SafeFileWriter.write(status_file, JSON.pretty_generate(@status))
end

#get(key) ⇒ Object



31
32
33
34
# File 'lib/droonga/node_status.rb', line 31

def get(key)
  key = normalize_key(key)
  @status[key]
end

#have?(key) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
# File 'lib/droonga/node_status.rb', line 26

def have?(key)
  key = normalize_key(key)
  @status.include?(key)
end

#reloadObject



48
49
50
# File 'lib/droonga/node_status.rb', line 48

def reload
  @status = load
end

#set(key, value) ⇒ Object



36
37
38
39
40
# File 'lib/droonga/node_status.rb', line 36

def set(key, value)
  key = normalize_key(key)
  @status[key] = value
  SafeFileWriter.write(status_file, JSON.pretty_generate(@status))
end