Module: Aquarium::Utils::SetUtils
- Included in:
- Aspects::Pointcut, Finders::FinderResult, OptionsUtils
- Defined in:
- lib/aquarium/utils/set_utils.rb
Class Method Summary collapse
-
.strip_set_nils(set) ⇒ Object
Return a new set that is a copy of the input set with all nils removed.
Instance Method Summary collapse
-
#make_set(*value_or_set_or_array) ⇒ Object
Return a set containing the input item or list of items.
-
#strip_set_nils(set) ⇒ Object
Return a new set that is a copy of the input set with all nils removed.
Class Method Details
.strip_set_nils(set) ⇒ Object
Return a new set that is a copy of the input set with all nils removed.
21 22 23 |
# File 'lib/aquarium/utils/set_utils.rb', line 21 def self.strip_set_nils set set.delete_if {|x| x.nil?} end |
Instance Method Details
#make_set(*value_or_set_or_array) ⇒ Object
Return a set containing the input item or list of items. If the input is a set or an array, it is returned. In all cases, the constructed set is a flattened version of the input and any nil elements are removed by #strip_set_nils. Note that this behavior effectively converts nil to [].
11 12 13 |
# File 'lib/aquarium/utils/set_utils.rb', line 11 def make_set *value_or_set_or_array strip_set_nils(convert_to_set(*value_or_set_or_array)) end |
#strip_set_nils(set) ⇒ Object
Return a new set that is a copy of the input set with all nils removed.
16 17 18 |
# File 'lib/aquarium/utils/set_utils.rb', line 16 def strip_set_nils set SetUtils.strip_set_nils set end |