Method: AIXM::Refinements#singleton_class
- Defined in:
- lib/aixm/refinements.rb
#singleton_class ⇒ Range
Note:
This is a refinement for Range
Returns a Range covering the given object.
To ease coverage tests in mixed arrays of single objects and object ranges, this method assures you’re always dealing with objects. It returns self if it is already a Range, otherwise builds one with the given single object as both beginning and end.
207 208 209 210 211 |
# File 'lib/aixm/refinements.rb', line 207 refine Range.singleton_class do def from(object) object.is_a?(Range) ? object : (object..object) end end |