Sha256: f1c261638ab329e55319838a568ab654e1a05f20fcd1fd855b908566af829390
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true require 'ruby_jard/color_scheme' module RubyJard ## # Color scheme registry. class ColorSchemes class << self extend Forwardable def_delegators :instance, :add_color_scheme, :[], :get, :names, :each, :length def instance @instance ||= new end end def initialize @color_scheme_registry = {} end def add_color_scheme(name, color_scheme_class) unless color_scheme_class < RubyJard::ColorScheme raise RubyJard::Error, "#{color_scheme_class} must implement, and inherit from #{RubyJard::ColorScheme}" end @color_scheme_registry[name] = color_scheme_class end def [](name) @color_scheme_registry[name.to_s.strip] end alias_method :get, :[] def names @color_scheme_registry.keys.sort.dup end def length @color_scheme_registry.length end def each(&block) @color_scheme_registry.each(&block) end end end require 'ruby_jard/color_schemes/deep_space_color_scheme' require 'ruby_jard/color_schemes/256_color_scheme' require 'ruby_jard/color_schemes/256_light_color_scheme' require 'ruby_jard/color_schemes/gruvbox_color_scheme' require 'ruby_jard/color_schemes/one_half_dark_color_scheme' require 'ruby_jard/color_schemes/one_half_light_color_scheme'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby_jard-0.3.1 | lib/ruby_jard/color_schemes.rb |
ruby_jard-0.3.0 | lib/ruby_jard/color_schemes.rb |