Class: Sane::API::OptionDescriptor::Range
- Inherits:
-
Struct
- Object
- Struct
- Sane::API::OptionDescriptor::Range
- Includes:
- Comparable, Enumerable
- Defined in:
- lib/sane/api.rb
Instance Attribute Summary collapse
-
#max ⇒ Object
Returns the value of attribute max.
-
#min ⇒ Object
Returns the value of attribute min.
-
#quant ⇒ Object
Returns the value of attribute quant.
Instance Method Summary collapse
Instance Attribute Details
#max ⇒ Object
Returns the value of attribute max
30 31 32 |
# File 'lib/sane/api.rb', line 30 def max @max end |
#min ⇒ Object
Returns the value of attribute min
30 31 32 |
# File 'lib/sane/api.rb', line 30 def min @min end |
#quant ⇒ Object
Returns the value of attribute quant
30 31 32 |
# File 'lib/sane/api.rb', line 30 def quant @quant end |
Instance Method Details
#<=>(x) ⇒ Object
33 34 35 |
# File 'lib/sane/api.rb', line 33 def <=> x (min..max) <=> x end |
#===(x) ⇒ Object
41 42 43 |
# File 'lib/sane/api.rb', line 41 def === x x.kind_of?( Numeric) and include?( x) end |
#each ⇒ Object
45 46 47 |
# File 'lib/sane/api.rb', line 45 def each min.step( max, [1,quant].max) end |
#include?(x) ⇒ Boolean
37 38 39 |
# File 'lib/sane/api.rb', line 37 def include? x (min..max).include?( x) and 0 == (x-min) % quant end |