Sha256: 2ec6634f2551104988968f89c9f51733e11786dbdd77abac06c8c5e705b70e7d

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

require "yaml"
require "digest"
require "inker/version"
require "inker/color"
require "inker/wrappers/string"


# The main module of the gem, which loads all necessary classes and
# provides a helper for {Inker::Color} object generation from a string and
# for named colors map.
module Inker
  class << self
    # Creates a new instance of {Inker::Color}, which could be used for color
    # manipulation or for collecting color info.
    #
    # @param str [String] the string to transform into {Inker::Color}
    # @return [Inker::Color]
    def color(str)
      Color.new(str)
    end


    # Returns the map of named colors and their respective HEX representation.
    #
    # @return [Hash] a map of named colors and their HEX color
    def named_colors
      @named_colors ||= YAML.load_file(File.expand_path('../data/colors.yml', __FILE__))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inker-0.2.0 lib/inker.rb
inker-0.1.0 lib/inker.rb