class ValueSemantics::RangeOf
Attributes
subvalidator[R]
Public Class Methods
new(subvalidator)
click to toggle source
# File lib/value_semantics/range_of.rb, line 5 def initialize(subvalidator) @subvalidator = subvalidator end
Public Instance Methods
===(obj)
click to toggle source
# File lib/value_semantics/range_of.rb, line 9 def ===(obj) return false unless Range === obj # begin or end can be nil, if the range is beginless or endless [obj.begin, obj.end].compact.all? do |element| subvalidator === element end end