Afficher un message
Vieux 19/06/2008, 17h16   #4
ara.t.howard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Advice for pluggable architecture


On Jun 19, 2008, at 7:54 AM, Robert Dober wrote:

> On Thu, Jun 19, 2008 at 3:22 PM, Robert Klemme
> <shortcutter@googlemail.com> wrote:
>
>> I am not sure whether this is a good idea: you force selection of the
>> algorithm into the data stream.

> Excellent point, that was what I wanted to avoid in the first place.
> <snip>
>>
>> I'd prefer making the mode part of the filter command line, i.e.
>>
>> ls -lR | rubyfilter myMode
>> ls -lR | ruby -r rubyfilter myMode
>>
>> or even chaining with
>>
>> ls -lR | rubyfilter myMode,myOtherMode
>> ls -lR | ruby -r rubyfilter myMode,myOtherMode

> I will probably go for
>
> rubyfilter -m mode
> rubyfilter --mode mode
>
> this is the unix way I guess
>
> the rest of your remarks need more thinking, thx.
> R
>


i rather like the concept of writing a custom filter entailing

#! /usr/bin/env ruby

require 'filter'
require 'uri'

filter do |line|

uris = URI.extract( line, 'http' ) + URI.extract( line, 'https' ) +
URI.extract( line, 'ftp' )

line = uris.join ','

end


requiring rubyfilter would do, roughly, this

class Filter
def initialize
# ...
end

def run
# ...
end
end

class Object
def filter *a, &b
filter = Filter.new(*a, &b)
filter.run if $0 == __FILE__
end
end


cheers.

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




  Réponse avec citation
 
Page generated in 0,05069 seconds with 9 queries