Method: SparseVector#initialize
- Defined in:
- lib/zipf/SparseVector.rb
#initialize(arg = nil) ⇒ SparseVector
Returns a new instance of SparseVector.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/zipf/SparseVector.rb', line 5 def initialize arg=nil super self.default = 0 if arg.is_a? Array from_a arg elsif arg.is_a? Hash from_h arg elsif arg.is_a? String from_s arg end end |