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.159 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.158 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.157 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.156 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.155 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.154 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.153 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.152 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.151 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.150 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.149 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.148 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.147 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.146 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.145 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.144 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.143 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.142 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.141 tracks/ruby/exercises/series/.meta/solutions/series.rb
trackler-2.2.1.140 tracks/ruby/exercises/series/.meta/solutions/series.rb