Sha256: fb60f528935de5c97235dab640ad84c23fbf9fa1b927aa2394767b3d6eb6454c

Contents?: true

Size: 383 Bytes

Versions: 2

Compression:

Stored size: 383 Bytes

Contents

require 'forwardable'
require 'erb'

class PageByPage
  class Url
    extend Forwardable

    def_delegator :@enum, :next

    def initialize tmpl
      @tmpl = ERB.new tmpl
      @enum = Enumerator.new do |yielder|
        n = 1
        loop do
          rendered = @tmpl.result binding
          yielder.yield rendered
          n = n.succ
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page_by_page-0.1.1 lib/page_by_page/url.rb
page_by_page-0.1.0 lib/page_by_page/url.rb