summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-10-23 11:47:19 -0700
committerelijah <elijah@riseup.net>2012-10-23 11:47:19 -0700
commit5fa7b15f726166771f743e2da94fc87da475cfee (patch)
treefcfa0b1b11d10456d05d47cf75dd7a39be2f1616
parentf87056ca4ff0b477bc9a7cb83496bbc4db39d652 (diff)
more attempt at 1.9 compatibility
-rw-r--r--lib/leap_cli.rb7
-rw-r--r--lib/leap_cli/config/manager.rb4
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/leap_cli.rb b/lib/leap_cli.rb
index e258cf3..a88a8ad 100644
--- a/lib/leap_cli.rb
+++ b/lib/leap_cli.rb
@@ -21,3 +21,10 @@ unless String.method_defined?(:to_a)
def to_a; [self]; end
end
end
+
+unless String.method_defined?(:any?)
+ class String
+ def any?; self.chars.any?; end
+ end
+end
+
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb
index 79ae5b8..8807cc9 100644
--- a/lib/leap_cli/config/manager.rb
+++ b/lib/leap_cli/config/manager.rb
@@ -176,7 +176,7 @@ module LeapCli
# inherit from services
if node['services']
- node['services'].sort.each do |node_service|
+ node['services'].to_a.sort.each do |node_service|
service = @services[node_service]
if service.nil?
log0('Error in node "%s": the service "%s" does not exist.' % [node['name'], node_service])
@@ -189,7 +189,7 @@ module LeapCli
# inherit from tags
if node['tags']
- node['tags'].sort.each do |node_tag|
+ node['tags'].to_a.sort.each do |node_tag|
tag = @tags[node_tag]
if tag.nil?
log0('Error in node "%s": the tag "%s" does not exist.' % [node['name'], node_tag])