lib/leap_cli/config/object.rb in leap_cli-1.7.3 vs lib/leap_cli/config/object.rb in leap_cli-1.7.4
- old
+ new
@@ -83,13 +83,17 @@
end
#
# export JSON
#
- def dump_json
+ def dump_json(*options)
evaluate(@node)
- JSON.sorted_generate(self)
+ if options.include? :compact
+ self.to_json
+ else
+ JSON.sorted_generate(self)
+ end
end
def evaluate(context=@node)
evaluate_everything(context)
late_evaluate_everything(context)
@@ -141,10 +145,10 @@
if self.has_key?(key)
fetch_value(key)
elsif key =~ /\./
# for keys with with '.' in them, we start from the root object (@node).
keys = key.split('.')
- value = @node.get!(keys.first)
+ value = self.get!(keys.first)
if value.is_a? Config::Object
value.get!(keys[1..-1].join('.'))
else
value
end
\ No newline at end of file