class Set
Override Set.to_hash
to complement Ruby::YAML's Set
implementation, where the YAML Set
syntax returns a Hash
with all-nil values, at least without some decorator sugar in the YAML itself: rhnh.net/2011/01/31/yaml-tutorial/
Since Set
is implemented using a Hash
internally I think it makes more sense for Set.to_hash
to return a Hash
with all-nil values with keys matching the contents of the original Set
.
Public Instance Methods
to_hash()
click to toggle source
# File lib/distorted/monkey_business/set.rb, line 12 def to_hash Hash[self.map { |s| [s, nil] }] end