Ruby namespace best practice.

For general discussion related FlowStone
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Ruby namespace best practice.

Post by Walter Sommerfeld »

Hmm,

did i miss something?

when i open ur
Simple Class Door.fsm
i always get the error:

NoMethodError: undefined method 'open?' for
#<Trog::Door:0xa9a74f0 @open=false
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Ruby namespace best practice.

Post by trogluddite »

Yes, that's right - I was demonstrating why Tronic's 'class method' style call would not work for an instance method - as in the comments...

Code: Select all

# Trog::Door is a class, not a Door!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Ruby namespace best practice.

Post by Walter Sommerfeld »

I understood... but even now?
Attachments
Class door.jpg
Class door.jpg (28.39 KiB) Viewed 16329 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Ruby namespace best practice.

Post by trogluddite »

Aaah - now I see!
Didn't read my own API docs! - the correct method is, of course "is_open?" not plain old "open?" - D'oh! :oops:
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Ruby namespace best practice.

Post by Walter Sommerfeld »

No prob -

i knew there must be a typo or...

ruby is 2 new 4 me - especially even w/o gems and some standard libs missing!

Even version conflicts/bugs inside ruby and the 'perfecto' :evil: editor in FS makes it more difficult 4 a beginner...

Keep on doing!

P.S: got an access denied error - damn where is that monster coming from (different schematic btw.)
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Ruby namespace best practice.

Post by trogluddite »

Walter Sommerfeld wrote:P.S: got an access denied error

What are you tying to access that it won't let you?
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Ruby namespace best practice.

Post by Walter Sommerfeld »

It was a:
'Dir.mkdir(temp_subfolder_name) unless File.exists?(temp_subfolder_name) # make folder if not exist'


i changed it into this:
if File.directory?(temp_path) #sun mod 20130503
#do nothing
#watch 'temp_path exist', temp_path
else
#watch 'temp_path_dont exists', temp_path
Dir.mkdir(temp_subfolder_name) unless File.exists?(temp_subfolder_name) # make folder if not exist
end
Post Reply