Class: EasyUpnp::ArgumentValidator::RangeValidator
- Inherits:
-
Object
- Object
- EasyUpnp::ArgumentValidator::RangeValidator
- Defined in:
- lib/easy_upnp/control_point/argument_validator.rb
Instance Attribute Summary collapse
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
-
#initialize(range) ⇒ RangeValidator
constructor
A new instance of RangeValidator.
- #validate(value) ⇒ Object
Constructor Details
#initialize(range) ⇒ RangeValidator
Returns a new instance of RangeValidator.
33 34 35 |
# File 'lib/easy_upnp/control_point/argument_validator.rb', line 33 def initialize(range) @range = range end |
Instance Attribute Details
#range ⇒ Object (readonly)
Returns the value of attribute range.
31 32 33 |
# File 'lib/easy_upnp/control_point/argument_validator.rb', line 31 def range @range end |
Instance Method Details
#validate(value) ⇒ Object
37 38 39 40 41 |
# File 'lib/easy_upnp/control_point/argument_validator.rb', line 37 def validate(value) if !@range.include?(value) raise ArgumentError, "#{value} is not in allowed range of values: #{@range.inspect}" end end |