Class: KDL::Types::Hostname
- Defined in:
- lib/kdl/types/hostname.rb,
lib/kdl/types/hostname/validator.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Validator
Constant Summary
Constants inherited from Value
Instance Attribute Summary
Attributes inherited from Value
Class Method Summary collapse
Methods inherited from Value
#as_type, from, #initialize, #stringify_value, #to_s
Constructor Details
This class inherits a constructor from KDL::Value
Class Method Details
.call(value, type = 'hostname') ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/kdl/types/hostname.rb', line 6 def self.call(value, type = 'hostname') return nil unless value.is_a? ::KDL::Value::String validator = Validator.new(value.value) raise ArgumentError, "invalid hostname #{value}" unless validator.valid? new(value.value, type: type) end |