I actually went over all of the implementations of ansi before writing
my own. What made me go over and write a new thing is that ansi does way
too many things besides ansi. I think that ansi should only take care of
ansi-related features! and their extensibility should be done apart. If
anyone wants to join gems am willing to help!

I see what you are trying to achieve there: you can do that pretty
easily with ISNA since it is very simple and extendible!

  require 'rubygems'
  require 'isna'

    class String

      def ansi background, foreground
        to_ansi.send("#{background}_background").send(foreground).to_s
      end

    end

  puts "Hello World".ansi(:red, :green)

You can see more cool examples on how to extend it here!
https://github.com/ktlacaelel/isna


Thomas Sawyer wrote in post #1034974:
> Fluid notation can be nice and simple, but it also has limitations. If
> you
> want to dynamically change the ansi code, it will be less elegant:
>
>   background = :green
>   foreground = :red
>
>   puts "Hello
> World".to_ansi.send("#{background}_background").send(foreground)
>
> Where as ANSI:
>
>   puts "Hello World".ansi("on_#{background}", foreground)
>
> Rather than have Yet Another ANSI gem (there are at least three others
> besides ansi) why not contribute to existing gem?

-- 
Posted via http://www.ruby-forum.com/.