Class: Configurations::Maps::Data
- Inherits:
-
Object
- Object
- Configurations::Maps::Data
- Defined in:
- lib/configurations/maps/data.rb
Defined Under Namespace
Classes: Entry
Instance Method Summary collapse
- #add_entry(path, value) ⇒ Object
-
#initialize(reader = Readers::Tolerant.new, writer = Writers::Default.new { |value| Entry.new(value) }) ⇒ Data
constructor
A new instance of Data.
- #nested?(path) ⇒ Boolean
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
21 22 23 |
# File 'lib/configurations/maps/data.rb', line 21 def nested?(path) @reader.read(@map, path) end |