Class: EacConfig::OldConfigs::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_config/old_configs/base.rb

Direct Known Subclasses

File

Instance Method Summary collapse

Instance Method Details

#[](entry_key) ⇒ Object



19
20
21
# File 'lib/eac_config/old_configs/base.rb', line 19

def [](entry_key)
  read(entry_key)
end

#[]=(entry_key, entry_value) ⇒ Object



15
16
17
# File 'lib/eac_config/old_configs/base.rb', line 15

def []=(entry_key, entry_value)
  write(entry_key, entry_value)
end

#clearObject



23
24
25
# File 'lib/eac_config/old_configs/base.rb', line 23

def clear
  replace({})
end

#read(entry_key) ⇒ Object



27
28
29
30
31
# File 'lib/eac_config/old_configs/base.rb', line 27

def read(entry_key)
  return nil unless data.key?(entry_key)

  data.fetch(entry_key).if_present(::EacRubyUtils::BlankNotBlank.instance)
end

#replace(new_data) ⇒ Object



33
34
35
# File 'lib/eac_config/old_configs/base.rb', line 33

def replace(new_data)
  self.data = ::EacConfig::PathsHash.new(new_data)
end

#write(entry_key, entry_value) ⇒ Object



37
38
39
# File 'lib/eac_config/old_configs/base.rb', line 37

def write(entry_key, entry_value)
  data[entry_key] = entry_value
end