SetClass
SetClass
Set as a class NOT as a struct enabling inheritance with a fixed type etc
ideally this will be an EXACT duplicate of the stdlib Set struct, but as a class (and with a name change) tests should all run as per the original (with obvious changes), and this should be maintained in parallel with the stdlib version ... why does this exist ... why does anything exist?
Installation
Add this to your application's shard.yml:
dependencies:
  SetC:
    github: johnjansen/SetClass
Usage
require "SetC"
class DictionaryOfWords < SetC(String)
  getter :max_word_size
  @max_word_size : Int32 = 0
  
  def add(other : String)
    @max_word_size = other.size if other.size > @max_word_size
    super
  end
end
d = DictionaryOfWords.new
d << "word"
d.max_word_size #=> 4
Contributing
- Fork it ( https://github.com/johnjansen/SetC/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- johnjansen John Jansen - creator, maintainer
Repository
  SetClass
Owner
  
  Statistic
  - 0
- 0
- 0
- 0
- 0
- almost 8 years ago
- November 28, 2017
License
  MIT License
Links
  
  Synced at
  Thu, 30 Oct 2025 10:46:33 GMT
Languages