Sha256: 9b7238f67712ac79f09b7db9853cf02db6d197e2d1c50d5769b245a0df813440
Contents?: true
Size: 661 Bytes
Versions: 2
Compression:
Stored size: 661 Bytes
Contents
# frozen_string_literal: true module PrettyFeed # Provide compatibility with Polluted and Unpolluted Strings module Compat define_method(:[]) do |str, color| return ColorizedString[str] if defined?(ColorizedString) return str if str.respond_to?(color.to_sym) dstr = str.dup dstr.singleton_class.send(:include, color_stub(str, color)) dstr end module_function :[] private def color_stub(str, color) Module.new do define_method(color.to_sym) do warn "Adding stub for missing '#{str}'.#{color}" self end end end module_function :color_stub end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pretty_feed-0.2.0 | lib/pretty_feed/compat.rb |
pretty_feed-0.1.1 | lib/pretty_feed/compat.rb |