Sha256: 4b049a8bf1db6b034bcf590b2eba473c065f279983e8902a45f9b72e056658d3

Contents?: true

Size: 607 Bytes

Versions: 5

Compression:

Stored size: 607 Bytes

Contents

module DotGrid
  module Page
    class Factory
      class UnknownPageExeception < Exception; end

      PAGES = {
        'dot_grid'        => ::DotGrid::Page::DotGrid,
        'planner'         => ::DotGrid::Page::Planner,
        'grid'            => ::DotGrid::Page::Grid,
        'horizontal_rule' => ::DotGrid::Page::HorizontalRule,
        'checkerboard'    => ::DotGrid::Page::Checkerboard
      }

      def self.build(page_type, params)
        raise UnknownPageExeception, "Unknown page type: #{page_type}" unless PAGES[page_type]
        PAGES[page_type].new(params)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dot_grid-0.0.10 lib/dot_grid/page/factory.rb
dot_grid-0.0.9 lib/dot_grid/page/factory.rb
dot_grid-0.0.8 lib/dot_grid/page/factory.rb
dot_grid-0.0.7 lib/dot_grid/page/factory.rb
dot_grid-0.0.6 lib/dot_grid/page/factory.rb