Sha256: 900336aa7d4f49d29bb2fba491f3fc2442fd52a60f8f7a9681e4e13515a43b19
Contents?: true
Size: 582 Bytes
Versions: 1
Compression:
Stored size: 582 Bytes
Contents
# frozen_string_literal: true module PrettyFeed # Provide compatibility with Polluted and Unpolluted Strings module Compat module_function define_method(:[]) do |str, color| if defined?(ColorizedString) ColorizedString[str] elsif str.respond_to?(color.to_sym) str else mod = Module.new do define_method(color.to_sym) do warn "String '#{self}' doesn't respond to #{color}" self end end str.singleton_class.send(:include, mod) str end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pretty_feed-0.1.0 | lib/pretty_feed/compat.rb |