Class: KDL::Types::Hostname
- Inherits:
-
Value::Custom
- Object
- Value
- Value::Custom
- 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::Custom
Attributes inherited from Value
Class Method Summary collapse
Methods inherited from Value::Custom
Methods inherited from Value
#==, #as_type, from, #initialize, #inspect, #method_missing, #respond_to_missing?, #stringify_value, #to_s, #to_v2, #version
Constructor Details
This class inherits a constructor from KDL::Value
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class KDL::Value
Class Method Details
.call(value, type = 'hostname') ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/kdl/types/hostname.rb', line 8 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 |