Sha256: 917d5a6b9933a19ad19b187f8a9e1212290da2111271f4ec165fcd5e6f74c26c

Contents?: true

Size: 419 Bytes

Versions: 2

Compression:

Stored size: 419 Bytes

Contents

module Pageflow
  class Themes
    include Enumerable

    def initialize
      @themes = HashWithIndifferentAccess.new
    end

    def register(name)
      @themes[name] = Theme.new(name)
    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

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-0.2.1 lib/pageflow/themes.rb
pageflow-0.2.0 lib/pageflow/themes.rb