Sha256: 83a4ac1f672a4c4d7f27f01978f7cac3192d0be74fdbc44ef42d914310441553

Contents?: true

Size: 406 Bytes

Versions: 2

Compression:

Stored size: 406 Bytes

Contents

require 'forwardable'
require 'erb'

class PageByPage
  class Url
    extend Forwardable

    def_delegator :@enum, :next

    def initialize tmpl, from: 1, step: 1
      @tmpl = ERB.new tmpl
      @enum = Enumerator.new do |yielder|
        n = from
        loop do
          rendered = @tmpl.result binding
          yielder.yield rendered
          n = n + step
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page_by_page-0.1.3 lib/page_by_page/url.rb
page_by_page-0.1.2 lib/page_by_page/url.rb