metasploit-framework/lib/msf/core/opt_float.rb

25 lines
420 B
Ruby
Raw Normal View History

2017-08-05 07:21:31 +00:00
# -*- coding: binary -*-
module Msf
###
#
# Float option.
#
###
class OptFloat < OptBase
def type
'float'
end
def normalize(value)
Float(value) if value.present? && valid?(value)
end
def valid?(value, check_empty: true)
return false if check_empty && empty_required_value?(value)
Float(value) rescue return false if value.present?
super
end
end
end