What's up with the funky names ... AND, is there an easy way to just require
all of them ?
I'd like to have all of nano and all of mega easily includable without 400
separate require statements ( exagerated I know, but still )
j.
The nice thing about Nano is that you can require just the extension
methods you need, no more, no less. I realize at first that seems
unecessarily burdensome, but in practice it actually proves be quite
natural. And I highly recommend you try to use the library in this
manner. Nonetheless, there is indeed a way to include a many a method
at once.
require 'nano/full'
But be forewarned, this is still experimental. The reason is that not
all of the methods in Nano "play nice" --some have very specific uses.
What I have done is make a list of these particular methods and
"subtract" them from the totality and this is what is in nano/full.rb.
But those lists are not complete/perfected yet, so don't be suprised if
something odd occurs when using 'full'. (And please let me know if you
run across something so I can adjust the lists!) To get more info on
what exactly these methods are try this:
require 'nanosys'
# list of method files in full
NanoSystem.full
# list of methods considered unsafe and not in full
NanoSystem.unsafe
# other methods not in full as a cautionary measure
NanoSystem.noauto
To learn more I recommend the README doc which is included in the
package and is also the front page of the API RDocs on the website
(http://nano.rubyforge.org)
As for Mega, again it is not the standard usage, but you can do:
require 'mega'
autoload_classes
Now whenever you reference a Mega Module it will be automatically
required (w/ a few exceptions.) As of yet I haven't thought of creating
a require file that loads all of them, but I suppose I can. Thanks for
the suggestion.
require 'nano' #Same as require 'nano/base', a common set of functionality
require 'nano/array' #All the array items
require 'nano/full' #Everything
···
On Aug 31, 2005, at 3:33 PM, Jeff Wood wrote:
[snip] AND, is there an easy way to just require all of them ?
I'd like to have all of nano and all of mega easily includable without 400
separate require statements ( exagerated I know, but still )
Since Ruby methods can have/be punctuation marks, it is necessary to
encode them in order to be compatible with all file systems. I have
used URI escaping so:
What's up with the funky names ... AND, is there an easy way to just
require
all of them ?
I'd like to have all of nano and all of mega easily includable without
400
separate require statements ( exagerated I know, but still )
In the API docs at nano.rubyforge.org and mega.rubyforge.org, check out the
documentation for the _files_ nano.rb, nano/base.rb (and mega's
corresponding files) to see the list of what's included there.
For example, if you just do:
require 'nano'
or:
require 'nano/base'
you will get all of these for free:
a.. nano/kernel/require_nano
b.. nano/array/to_h
c.. nano/binding/eval
d.. nano/binding/self
e.. nano/binding/caller
f.. nano/comparable/cmp
g.. nano/enumerable/collect_with_counter
h.. nano/enumerable/each_slice
i.. nano/float/round_off
j.. nano/float/round_to
k.. nano/float/round_at
l.. nano/hash/slice
m.. nano/hash/to_h
n.. nano/kernel/fn
o.. nano/kernel/called
p.. nano/kernel/here
q.. nano/matchdata/match
r.. nano/module/basename
s.. nano/nilclass/to_f
t.. nano/nilclass/to_h
u.. nano/object/metaclass
v.. nano/proc/to_method
w.. nano/range/to_r
x.. nano/regexp/to_re
y.. nano/string/blank%3F
z.. nano/string/cmp
aa.. nano/string/to_re
ab.. nano/symbol/not
ac.. nano/time/to_time
Then there's the require_* methods, require_all in particular.
What's up with the funky names ... AND, is there an easy way to just require
all of them ?
I'd like to have all of nano and all of mega easily includable without 400
separate require statements ( exagerated I know, but still )
In the API docs at nano.rubyforge.org and mega.rubyforge.org, check out the documentation for the _files_ nano.rb, nano/base.rb (and mega's corresponding files) to see the list of what's included there.
For example, if you just do:
require 'nano'
or:
require 'nano/base'
you will get all of these for free:
a.. nano/kernel/require_nano
b.. nano/array/to_h
c.. nano/binding/eval
d.. nano/binding/self
e.. nano/binding/caller
f.. nano/comparable/cmp
g.. nano/enumerable/collect_with_counter
h.. nano/enumerable/each_slice
i.. nano/float/round_off
j.. nano/float/round_to
k.. nano/float/round_at
l.. nano/hash/slice
m.. nano/hash/to_h
n.. nano/kernel/fn
o.. nano/kernel/called
p.. nano/kernel/here
q.. nano/matchdata/match
r.. nano/module/basename
s.. nano/nilclass/to_f
t.. nano/nilclass/to_h
u.. nano/object/metaclass
v.. nano/proc/to_method
w.. nano/range/to_r
x.. nano/regexp/to_re
y.. nano/string/blank%3F
z.. nano/string/cmp
aa.. nano/string/to_re
ab.. nano/symbol/not
ac.. nano/time/to_time
Then there's the require_* methods, require_all in particular.
Happy requiring!
Dave
Yeah, about 10 seconds after I sent the mail I found that part of the docs ... Felt like a real goon. Anyways, thanks for putting the information into the docs, and for shooting me a note.
Since Ruby methods can have/be punctuation marks, it is necessary to
encode them in order to be compatible with all file systems. I have
used URI escaping so:
: -> %3A
? -> %3F
! -> %21
= -> %3D
etc.
Wow, I'd say that the punctionation ( with conversion or not ) should come out of the filenames... the %3A stuff is about as un-user-friendly as anything I've ever seen.
Wow, I'd say that the punctionation ( with conversion or not ) should
come out of the filenames... the %3A stuff is about as un-user-friendly
as anything I've ever seen.
You'd have to have a better alternative, and I can't think of one.
Consistent naming's important, and I'd rather not be using interesting
suffixes like "nano/array/rotate_bang".
To ease the pain, instead of:
require 'nano/array/rotate%21'
nano provides:
require 'nanoreq' # or nanosys or nano or nano/base
require_nano 'array/rotate!'
and I presume mega has an analog.
You'd have to have a better alternative, and I can't think of one. Consistent naming's important, and I'd rather not be using interesting suffixes like "nano/array/rotate_bang".
Why not? I think I would prefer this over uri escaping. It's also the convention Ruby uses for the C method names.
Wow, I'd say that the punctionation ( with conversion or not ) should
come out of the filenames... the %3A stuff is about as un-user-friendly
as anything I've ever seen.
You'd have to have a better alternative, and I can't think of one. Consistent naming's important, and I'd rather not be using interesting suffixes like "nano/array/rotate_bang".
To ease the pain, instead of:
require 'nano/array/rotate%21'
nano provides:
require 'nanoreq' # or nanosys or nano or nano/base
require_nano 'array/rotate!'
and I presume mega has an analog.
Cheers,
Dave
well, there are many alternatives.. I'd just have require 'nano/array' or if you still want the one-by-one functionality ... require 'nano/array/rotate'
Yeah, I have to agree here. I can translate ! to _bang a lot easier than I can think up what the URI escape code is.
James Edward Gray II
···
On Sep 1, 2005, at 8:59 AM, Florian Groß wrote:
Dave Burt wrote:
You'd have to have a better alternative, and I can't think of one. Consistent naming's important, and I'd rather not be using interesting suffixes like "nano/array/rotate_bang".
Why not? I think I would prefer this over uri escaping. It's also the convention Ruby uses for the C method names.
It thought nano tweaks include to do the conversion behind the scenes.
Such that you can do
require 'file/exists?'
and require first escapes the ? and then calls the old require.
But I have not used this libs so far.
regards,
Brian
···
On 01/09/05, James Edward Gray II <james@grayproductions.net> wrote:
On Sep 1, 2005, at 8:59 AM, Florian Groß wrote:
> Dave Burt wrote:
>
>
>> You'd have to have a better alternative, and I can't think of one.
>> Consistent naming's important, and I'd rather not be using
>> interesting suffixes like "nano/array/rotate_bang".
>>
>
> Why not? I think I would prefer this over uri escaping. It's also
> the convention Ruby uses for the C method names.
Yeah, I have to agree here. I can translate ! to _bang a lot easier
than I can think up what the URI escape code is.
Yeah, I have to agree here. I can translate ! to _bang a lot easier than I can think up what the URI escape code is.
Bang is pretty easy.
You're probably right.
What are suggestions for #=
Good example. That's a tough one. My best thought:
indexed_equals
or #foo versus #foo= ?
This one seems obvious to me:
foo
foo_equals
To be perfectly honest though, I haven't even downloaded the library in question, so I have literally no say here. I was just agreeing that I code remember a word better than a code.
I'll go back to minding my own business now.
James Edward Gray II
···
On Sep 1, 2005, at 9:25 AM, Gavin Kistner wrote:
On Sep 1, 2005, at 8:11 AM, James Edward Gray II wrote:
So if you think remebering a handful or two URI escape codes is hard,
think how much harder it would be to remember dozens and dozens of
semi-inconsistent names and the punctuation they correspond-to. I do
not say this w/o inexperience either, since the last version of Facets
actually did just that. It wasn't nice. The escapes look weird but they
quickly become old hat, and are easy enough to look up:
ruby -ruri -e'p URI.escape( "!", "!" )'
But also, you do not need to bother with them at all. There are a
couple of options for forgetting about the whole thing. The simplest
is:
require 'nanosys'
Then you can use the actual punctuation all you want --and w/o any
special require method: