R
Robert Dober
Dear list
I am currently working on a new project (actually it is very old in my
head >3 years) which I called Rubyfilter.
I know exactly what I want it to do, not bad . But before I ask the
question it might be useful to describe its context.
Rubyfilter will be more or less what the name says, a classic filter
program -as defined in the good ol'Unix way- taking some input and
producing some output.
The way how the output is produced by the input is almost completely
undefined and depends on what I call a mode. My intention is to
provide at least an html mode with the first version and a rich?
toolbox to implement new modes easily.
The mode is defined in the first line of the input and then everything
else is passed into the "handler" as defined for that mode.
It shall be *extremely* easy to write new modes and I have come up
with the following model.
(1) There is one main file to be required called
lib/rubyfilter/runner.rb it defines a class Rubyfilter and a class
method run_file, there will be a commandline frontend bin/rubyfilter
too.
(2) Writing a mode means putting a file with the name <mode>.rb into
lib/rubyfilter/modes and defining an instance method
RubyfilterMode#process_data. This method will be called with two IO
objects the first being the input (containing all input but the
modeline), the second being the output. RubyfilterMode is a module
that will be used to extend Rubyfilter which I intend to use as a
singleton.
(3) lib/rubyfilter/tools contains the toolbox and groups methods
depending on their use into different modules. It is up to the toolbox
user to include these modules into the RubyfilterMode module and thus
into the singleton Rubyfilter or create her own objects with the
behavior of these modules.
These design decisions come from thinking, but thinking cannot replace
doing and I do not have a big experience in code organization. But
this decision surely is crucial for the acceptance of the toolkit by
potential mode implementors and shall not be object to change. I would
therefore love to have some input on this from you folks.
Thanx in advance
Robert
--=20
http://ruby-smalltalk.blogspot.com/
---
Les m=EAmes questions qu'on se pose
On part vers o=F9 et vers qui
Et comme indice pas grand-chose
Des roses et des orties.
-
Francis Cabrel
I am currently working on a new project (actually it is very old in my
head >3 years) which I called Rubyfilter.
I know exactly what I want it to do, not bad . But before I ask the
question it might be useful to describe its context.
Rubyfilter will be more or less what the name says, a classic filter
program -as defined in the good ol'Unix way- taking some input and
producing some output.
The way how the output is produced by the input is almost completely
undefined and depends on what I call a mode. My intention is to
provide at least an html mode with the first version and a rich?
toolbox to implement new modes easily.
The mode is defined in the first line of the input and then everything
else is passed into the "handler" as defined for that mode.
It shall be *extremely* easy to write new modes and I have come up
with the following model.
(1) There is one main file to be required called
lib/rubyfilter/runner.rb it defines a class Rubyfilter and a class
method run_file, there will be a commandline frontend bin/rubyfilter
too.
(2) Writing a mode means putting a file with the name <mode>.rb into
lib/rubyfilter/modes and defining an instance method
RubyfilterMode#process_data. This method will be called with two IO
objects the first being the input (containing all input but the
modeline), the second being the output. RubyfilterMode is a module
that will be used to extend Rubyfilter which I intend to use as a
singleton.
(3) lib/rubyfilter/tools contains the toolbox and groups methods
depending on their use into different modules. It is up to the toolbox
user to include these modules into the RubyfilterMode module and thus
into the singleton Rubyfilter or create her own objects with the
behavior of these modules.
These design decisions come from thinking, but thinking cannot replace
doing and I do not have a big experience in code organization. But
this decision surely is crucial for the acceptance of the toolkit by
potential mode implementors and shall not be object to change. I would
therefore love to have some input on this from you folks.
Thanx in advance
Robert
--=20
http://ruby-smalltalk.blogspot.com/
---
Les m=EAmes questions qu'on se pose
On part vers o=F9 et vers qui
Et comme indice pas grand-chose
Des roses et des orties.
-
Francis Cabrel