Class: Suspenders::Actions::ExpandJson

Inherits:
Object
  • Object
show all
Defined in:
lib/suspenders/actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(destination_root, file, data) ⇒ ExpandJson

Returns a new instance of ExpandJson.



35
36
37
38
39
# File 'lib/suspenders/actions.rb', line 35

def initialize(destination_root, file, data)
  @destination_root = destination_root
  @file = file
  @data = data
end

Instance Method Details

#invoke!Object



41
42
43
# File 'lib/suspenders/actions.rb', line 41

def invoke!
  write_out { |existing_json| existing_json.deep_merge(data) }
end

#revoke!Object



45
46
47
# File 'lib/suspenders/actions.rb', line 45

def revoke!
  write_out { |existing_json| hash_unmerge(existing_json, data) }
end