Skip to content

Commit e84765c

Browse files
sn0wfa11Brent Cook
authored andcommitted
All functions have yard doc like comments
1 parent c5391c2 commit e84765c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

modules/post/multi/manage/autoroute.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def route_cmd
5151
end
5252

5353
# Run Method for when run command is issued
54+
#
55+
# @return [void] A useful return value is not expected here
5456
def run
5557
return unless session_good?
5658

@@ -170,8 +172,12 @@ def print_routes
170172
end
171173
end
172174

175+
# Validation check on an IPv4 address
176+
#
173177
# Yet another IP validator. I'm sure there's some Rex
174178
# function that can just do this.
179+
#
180+
# @return [string class] IPv4 subnet
175181
def check_ip(ip=nil)
176182
return false if(ip.nil? || ip.strip.empty?)
177183
begin
@@ -182,11 +188,17 @@ def check_ip(ip=nil)
182188
end
183189
end
184190

191+
# Converts a CIDR value to a netmask
192+
#
193+
# @return [string class] IPv4 netmask
185194
def cidr_to_netmask(cidr)
186195
int = cidr.gsub(/\x2f/,"").to_i
187196
Rex::Socket.addr_ctoa(int)
188197
end
189198

199+
# Validates the user input 'NETMASK'
200+
#
201+
# @return [string class] IPv4 netmask
190202
def netmask
191203
case datastore['NETMASK']
192204
when /^\x2f[0-9]{1,2}/
@@ -432,6 +444,9 @@ def interface_compatible?
432444
end
433445

434446
# Validates the command options
447+
#
448+
# @return [true class] Everything is good
449+
# @return [false class] Not so much
435450
def validate_cmd(subnet=nil,netmask=nil)
436451
if subnet.nil?
437452
print_error "Missing subnet option"

0 commit comments

Comments
 (0)