Class: Geospatial::Filter::Range
- Inherits:
-
Object
- Object
- Geospatial::Filter::Range
- Defined in:
- lib/geospatial/filter.rb
Instance Attribute Summary collapse
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
Instance Method Summary collapse
-
#expand!(prefix, order) ⇒ Object
Returns the new max if expansion was possible, or nil otherwise.
- #include?(hash) ⇒ Boolean
-
#initialize(prefix, order) ⇒ Range
constructor
A new instance of Range.
- #to_s ⇒ Object
Constructor Details
#initialize(prefix, order) ⇒ Range
Returns a new instance of Range.
24 25 26 27 |
# File 'lib/geospatial/filter.rb', line 24 def initialize(prefix, order) @min = prefix update_max(prefix, order) end |
Instance Attribute Details
#max ⇒ Object (readonly)
Returns the value of attribute max.
30 31 32 |
# File 'lib/geospatial/filter.rb', line 30 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
29 30 31 |
# File 'lib/geospatial/filter.rb', line 29 def min @min end |
Instance Method Details
#expand!(prefix, order) ⇒ Object
Returns the new max if expansion was possible, or nil otherwise.
37 38 39 40 41 |
# File 'lib/geospatial/filter.rb', line 37 def (prefix, order) if @max < prefix and prefix == @max+1 update_max(prefix, order) end end |
#include?(hash) ⇒ Boolean
43 44 45 |
# File 'lib/geospatial/filter.rb', line 43 def include?(hash) hash >= min and hash <= max end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/geospatial/filter.rb', line 32 def to_s "#{min.to_s(2)}..#{max.to_s(2)}" end |