| Quick workaround for leading zeros in ranges - warvox - VoIP based wardialing t… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit dd744e64319e514c8d8f7b1cf5ff47e055c4cf70 | |
| parent 04945e185bc5b0b9fc877ca31ecaba9f8b0f681a | |
| Author: HD Moore <[email protected]> | |
| Date: Wed, 27 May 2015 10:56:24 -0500 | |
| Quick workaround for leading zeros in ranges | |
| Diffstat: | |
| M lib/warvox/phone.rb | 9 ++++++++- | |
| 1 file changed, 8 insertions(+), 1 deletion(-) | |
| --- | |
| diff --git a/lib/warvox/phone.rb b/lib/warvox/phone.rb | |
| @@ -15,9 +15,16 @@ class Phone | |
| if(mask.index(':')) | |
| next if mask.index('X') | |
| + | |
| + # Quick hack to fix leading 0s | |
| + prefix = "" | |
| + if mask =~ /^(0+)/ | |
| + prefix = $1 | |
| + end | |
| + | |
| rbeg,rend = mask.split(':').map{|c| c.gsub(/[^… | |
| rbeg.upto(rend) do |n| | |
| - res[n.to_s] = {} | |
| + res[prefix + n.to_s] = {} | |
| end | |
| next | |
| end |