Sha256: 9480e22bf73b2c792442d2fb02b079467755ddd3686e2fd305085c6e95a33cfd

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 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,
        'grid_plus_lines' => ::DotGrid::Page::GridPlusLines,
        '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

1 entries across 1 versions & 1 rubygems

Version Path
dot_grid-0.0.11 lib/dot_grid/page/factory.rb