Sha256: ddc1ab6f90d27ea30ee4d2260bb15dedc655ea041c6b8fc38e01dff10116c811

Contents?: true

Size: 309 Bytes

Versions: 340

Compression:

Stored size: 309 Bytes

Contents

class Series
  def initialize(series)
    @series = (series)
  end
  def slices(n)
    if n > @series.length
      raise ArgumentError
    end
    series = @series
    substrings = []
    until series.length < n
      substrings << series[0..n-1]
      series = series[1..-1]
    end
    substrings
  end
end

Version data entries

340 entries across 340 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.179 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.178 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.177 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.176 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.175 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.174 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.173 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.172 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.171 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.170 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.169 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.167 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.166 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.165 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.164 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.163 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.162 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.161 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.160 tracks/ruby/exercises/series/.meta/solutions/series.rb