Class: Configurations::Maps::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/configurations/maps/data.rb

Defined Under Namespace

Classes: Entry

Instance Method Summary collapse

Constructor Details

#initialize(reader = Readers::Tolerant.new, writer = Writers::Default.new { |value| Entry.new(value) }) ⇒ Data

Returns a new instance of Data.



10
11
12
13
14
15
16
17
18
19
# File 'lib/configurations/maps/data.rb', line 10

def initialize(
  reader = Readers::Tolerant.new,
  writer = Writers::Default.new { |value|
    Entry.new(value)
  }
)
  @map = {}
  @reader = reader
  @writer = writer
end

Instance Method Details

#add_entry(path, value) ⇒ Object



25
26
27
# File 'lib/configurations/maps/data.rb', line 25

def add_entry(path, value)
  @writer.write(@map, path, value)
end

#nested?(path) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/configurations/maps/data.rb', line 21

def nested?(path)
  @reader.read(@map, path)
end