module JSON::OnSteroids::MergeOperations
Direct including types
Defined in:
json_on_steroids/merge_operations.crInstance Method Summary
-
#%(t : Enumerable)
return a JSON object containing only the JSON fields requested in the argument enumerable
-
#-(t : Enumerable)
return a JSON object removing the JSON fields defined by the argument enumerable
- #merge(x : NamedTuple)
- #merge!(x : NamedTuple)
Instance Method Detail
def %(t : Enumerable)
#
return a JSON object containing only the JSON fields requested in the argument enumerable
json = JSON.parse(%<{"a": 1, "b": 2, "c": [1,2,3]}>).on_steroid
json = json % {"a", "b"} # => {"a": 1, "b": 2}
def -(t : Enumerable)
#
return a JSON object removing the JSON fields defined by the argument enumerable
json = JSON.parse(%<{"user": "yacine", "password": "helloworld"}>).on_steroid
json = json - {:password} # => {"a": 1, "b": 2}