Page 2 of 2
Re: Ruby namespace best practice.
Posted: Wed May 01, 2013 11:48 am
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
Re: Ruby namespace best practice.
Posted: Thu May 02, 2013 9:04 am
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!
Re: Ruby namespace best practice.
Posted: Thu May 02, 2013 11:54 am
by Walter Sommerfeld
I understood... but even now?
Re: Ruby namespace best practice.
Posted: Thu May 02, 2013 8:53 pm
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!

Re: Ruby namespace best practice.
Posted: Fri May 03, 2013 4:05 pm
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'

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.)
Re: Ruby namespace best practice.
Posted: Fri May 03, 2013 6:28 pm
by trogluddite
Walter Sommerfeld wrote:P.S: got an access denied error
What are you tying to access that it won't let you?
Re: Ruby namespace best practice.
Posted: Sat May 04, 2013 9:40 am
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