lib/pastel/alias_importer.rb in pastel-0.5.3 vs lib/pastel/alias_importer.rb in pastel-0.6.0
- old
+ new
@@ -4,15 +4,16 @@
# A class responsible for importing color aliases
class AliasImporter
# Create alias importer
#
# @example
- # importer = Pastel::AliasImporter.new(Pastel::Color.new)
+ # importer = Pastel::AliasImporter.new(Pastel::Color.new, {})
#
# @api public
- def initialize(color, output = $stderr)
+ def initialize(color, env, output = $stderr)
@color = color
+ @env = env
@output = output
end
# Import aliases from the environment
#
@@ -22,11 +23,11 @@
#
# @return [nil]
#
# @api public
def import
- color_aliases = ENV['PASTEL_COLORS_ALIASES']
+ color_aliases = env['PASTEL_COLORS_ALIASES']
return unless color_aliases
color_aliases.split(',').each do |color_alias|
new_color, old_color = color_alias.split('=').map(&:to_sym)
if !new_color || !old_color
output.puts "Bad color mapping `#{color_alias}`"
@@ -36,8 +37,8 @@
end
end
protected
- attr_reader :color, :output
+ attr_reader :color, :output, :env
end # AliasImporter
end # Pastel