aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-10-31 00:00:04 -0700
committerelijah <elijah@riseup.net>2014-10-31 00:00:04 -0700
commit73ccc3396d65a097d3395798438576c4257f5234 (patch)
tree5e3e96852be59140c58d6b269ce8b8a473bee1d6 /lib
parent1d7cba188444bdf65b7c5434699cfdb4bad24f73 (diff)
downloadleap_cli-73ccc3396d65a097d3395798438576c4257f5234.tar.gz
leap_cli-73ccc3396d65a097d3395798438576c4257f5234.tar.bz2
allow json properties to be named 'key'
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/config/object.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb
index 489b1d2..45144bc 100644
--- a/lib/leap_cli/config/object.rb
+++ b/lib/leap_cli/config/object.rb
@@ -64,6 +64,11 @@ module LeapCli
get(key)
end
+ # Overrride some default methods in Hash that are likely to
+ # be used as attributes.
+ alias_method :hkey, :key
+ def key; get('key'); end
+
#
# make hash addressable like an object (e.g. obj['name'] available as obj.name)
#
@@ -288,23 +293,23 @@ module LeapCli
Util::log "offending string: #{value}", :indent => 1
Util::log "error message: no file '#{exc}'", :indent => 1
end
+ raise exc if LeapCli.log_level >= 2
end
- raise exc if LeapCli.log_level >= 2
rescue AssertionFailed => exc
Util.bail! do
Util::log :failed, "assertion while evaluating node '#{self.name}'"
Util::log 'assertion: %s' % exc.assertion, :indent => 1
Util::log "offending key: #{key}", :indent => 1
+ raise exc if LeapCli.log_level >= 2
end
- raise exc if LeapCli.log_level >= 2
rescue SyntaxError, StandardError => exc
Util::bail! do
Util::log :error, "while evaluating node '#{self.name}'"
Util::log "offending key: #{key}", :indent => 1
Util::log "offending string: #{value}", :indent => 1
Util::log "error message: #{exc.inspect}", :indent => 1
+ raise exc if LeapCli.log_level >= 2
end
- raise exc if LeapCli.log_level >= 2
end
private