Module: DevSuite::Utils::Data::PathAccess::PathAccessor
- Extended by:
- PathAccessor
- Included in:
- PathAccessor
- Defined in:
- lib/dev_suite/utils/data/path_access/path_accessor.rb
Instance Method Summary collapse
-
#delete(data, path) ⇒ Object
Delete key in nested data.
-
#get(data, path) ⇒ Object
Get value from nested data.
-
#set(data, path, value) ⇒ Object
Set value in nested data.
Instance Method Details
#delete(data, path) ⇒ Object
Delete key in nested data
28 29 30 31 |
# File 'lib/dev_suite/utils/data/path_access/path_accessor.rb', line 28 def delete(data, path) keys = PathParser.parse(path) DataTraverser.remove(data, keys) end |
#get(data, path) ⇒ Object
Get value from nested data
16 17 18 19 |
# File 'lib/dev_suite/utils/data/path_access/path_accessor.rb', line 16 def get(data, path) keys = PathParser.parse(path) DataTraverser.fetch(data, keys) end |
#set(data, path, value) ⇒ Object
Set value in nested data
22 23 24 25 |
# File 'lib/dev_suite/utils/data/path_access/path_accessor.rb', line 22 def set(data, path, value) keys = PathParser.parse(path) DataTraverser.assign(data, keys, value) end |