Sha256: 5ac904be71c29af9264ed56173bd2b73fbedf35375e02c452f93c7f858e7d8ea

Contents?: true

Size: 358 Bytes

Versions: 4

Compression:

Stored size: 358 Bytes

Contents

module Dolly
  class PropertySet < Set
    def include? key
      keys.include?(key)
    end

    def <<(property)
      return if include?(property.key)
      super(property)
    end

    def [](key)
      return detect {|property| property.key == key } if key.is_a?(Symbol)
      super
    end

    private

    def keys
      map(&:key)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dolly-3.1.2 lib/dolly/property_set.rb
dolly-3.1.1 lib/dolly/property_set.rb
dolly-3.1.0 lib/dolly/property_set.rb
dolly-3.0.1 lib/dolly/property_set.rb