J
jandot
Hi all,
For one of my libraries, I have to create nested namespaces such as
Bio::Graphics:anel::Track::Feature. Code for these is contained in
separated files: the code for Bio::Graphics:anel in panel.rb, the
code for Bio::Graphics:anel::Track in track.rb and
Bio::Graphics:anel::Track::Feature in feature.rb.
Unfortunately, I don't know a way of putting the whole namespace on
one line in e.g. feature.rb. As a result, every single line of code
has to be preceded with 12 spaces. But this can become cumbersome and
is basically a waste of, well, space...
Here's what it looks like:
...module Bio
.....module Graphics
.......class Panel
.........class Track
...........class Feature
.............# all
.............# the
.............# code
.............# needs
.............# 12 spaces
...........end
.........end
.......end
.....end
...end
What I _could_ do is something like this:
...module Bio
...module Graphics
...class Panel
...class Track
...class Feature
.....# all
.....# the
.....# code
.....# just
.....# needs
.....# 4 spaces
...end
...end
...end
...end
...end
But then you end up with just a whole string of "end"s at the bottom
of your file. Isn't there a way to define the complete namespace in
one go on one line?
I've tried things like
...class Bio::Graphics:anel::Track::Feature
.....def initialize()
.....end
...end
But that didn't work. Any suggestions welcome.
Thanks,
jan.
For one of my libraries, I have to create nested namespaces such as
Bio::Graphics:anel::Track::Feature. Code for these is contained in
separated files: the code for Bio::Graphics:anel in panel.rb, the
code for Bio::Graphics:anel::Track in track.rb and
Bio::Graphics:anel::Track::Feature in feature.rb.
Unfortunately, I don't know a way of putting the whole namespace on
one line in e.g. feature.rb. As a result, every single line of code
has to be preceded with 12 spaces. But this can become cumbersome and
is basically a waste of, well, space...
Here's what it looks like:
...module Bio
.....module Graphics
.......class Panel
.........class Track
...........class Feature
.............# all
.............# the
.............# code
.............# needs
.............# 12 spaces
...........end
.........end
.......end
.....end
...end
What I _could_ do is something like this:
...module Bio
...module Graphics
...class Panel
...class Track
...class Feature
.....# all
.....# the
.....# code
.....# just
.....# needs
.....# 4 spaces
...end
...end
...end
...end
...end
But then you end up with just a whole string of "end"s at the bottom
of your file. Isn't there a way to define the complete namespace in
one go on one line?
I've tried things like
...class Bio::Graphics:anel::Track::Feature
.....def initialize()
.....end
...end
But that didn't work. Any suggestions welcome.
Thanks,
jan.