Sha256: 32fb3df9fa346af169e8515fe39ba8755d93f12e307dceaf340b8cdd33d315f9

Contents?: true

Size: 442 Bytes

Versions: 10

Compression:

Stored size: 442 Bytes

Contents

module Pageflow
  class Themes
    include Enumerable

    def initialize
      @themes = HashWithIndifferentAccess.new
    end

    def register(name, options = {})
      @themes[name] = Theme.new(name, options)
    end

    def get(name)
      @themes.fetch(name) { raise(ArgumentError, "Unknown theme '#{name}'.") }
    end

    def names
      map(&:name)
    end

    def each(&block)
      @themes.values.each(&block)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pageflow-0.8.2 lib/pageflow/themes.rb
pageflow-0.8.1 lib/pageflow/themes.rb
pageflow-0.8.0 lib/pageflow/themes.rb
pageflow-0.7.2 lib/pageflow/themes.rb
pageflow-0.7.1 lib/pageflow/themes.rb
pageflow-0.7.0 lib/pageflow/themes.rb
pageflow-0.6.0 lib/pageflow/themes.rb
pageflow-0.5.0 lib/pageflow/themes.rb
pageflow-0.4.0 lib/pageflow/themes.rb
pageflow-0.3.0 lib/pageflow/themes.rb