Ruby Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesRuby Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 15th, 2008, 10:49 PM
drhenner drhenner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 drhenner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 53 sec
Reputation Power: 0
What file does the Class belong

OK I am running fedora 9 and ruby 1.8.6. I run the following command (Time.methods) and only 1/2 of the methods I expect are included. When I look at the Time class I se all the methods. I assume I am clashing with another Class called Time but I don't see it. If i put (require 'time') I see all the methods.

I just want to know where the files is that created the object with 1/2 the methods. what is the best way to solve this?

Reply With Quote
  #2  
Old May 16th, 2008, 05:15 AM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 642 L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 12 h 48 m 20 sec
Reputation Power: 102
Send a message via AIM to L7Sqr
Code:
irb(main):001:0> Time.methods.size
=> 83
irb(main):002:0> require 'time'
=> true
irb(main):003:0> Time.methods.size
=> 90

I'm not sure 7 extra methods constitutes half...
Also, so you know,
Quote:
Originally Posted by Pickaxe
The time library adds functionality to the built-in class Time, supporting date and/or time formats used by RFC 2882 (e-mail), RFC 2616 (HTTP), and ISO 8601 (the subset used by XML schema)
__________________
-- I'll provide you with reference points; if they dont work, refer to something else.

If you process text, this might make your life a little easier.

Reply With Quote
  #3  
Old May 16th, 2008, 08:18 AM
drhenner drhenner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 drhenner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 53 sec
Reputation Power: 0
sorry about saying 1/2... but I still have a question...


I just want to know where the files is that created the object with 1/2 the methods. what is the best way to solve this?

basically mongrel uses the method httpdate. this method was working before I upgraded fedora and now i mongrel gives me a NO method error.

My app uses httpdate too so it's not wise to go through every file and (require 'time')

Reply With Quote
  #4  
Old May 16th, 2008, 10:18 AM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 642 L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 12 h 48 m 20 sec
Reputation Power: 102
Send a message via AIM to L7Sqr
Quote:
Originally Posted by drhenner
so it's not wise to go through every file and (require 'time')
Unless, of course, each of those files requires the time library...

Reply With Quote
  #5  
Old May 16th, 2008, 05:17 PM
drhenner drhenner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 drhenner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 53 sec
Reputation Power: 0
well i found the bug.

the files (Mongrel) were already requiring time...

someone added a time class to my rails app in subversion and mongrel got all messed up.

still would like to know how to get the file that a Class exist's in with ruby code. I did a grep for "class Time" but that wasn't ruby was it.

Anyone know my original question please answer.

Thank you

Reply With Quote
  #6  
Old May 16th, 2008, 05:37 PM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 642 L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 12 h 48 m 20 sec
Reputation Power: 102
Send a message via AIM to L7Sqr
I'm not sure I understand you completely.
Let me explain what I think I know before I give my answer:
You are looking for the source code used to build the Time object.
You are also looking for the source code used to build the extended library Time object.

To answer those two, you will need to have access to the source tree you compiled when you installed ruby. From my source tree it looks something like:
Code:
ruby-1.8.6/time.c   (the standard time class)
ruby-1.8.6/lib/time.rb    (the extended interface to that class)


Although I can not seem to understand why you would need access to those files (specifically the C files). If you changed them, you would not affect the binaries that are currently being run. If you changed them with the intent of rebuilding the binaries you would have to know a lot more that it appears that you know now. Also, if you did actually change things, it would only be good on your personal system since other will have the regular version on their system. You can find all the documentation on a class either online or in a book, why is it you are looking through these files? (Sorry to belabor the point here...)
The library file is written in ruby, but the same caveat applies about changing that file and trying to deploy.

Hope that helps.

Reply With Quote
  #7  
Old May 19th, 2008, 03:53 PM
drhenner drhenner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 drhenner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 53 sec
Reputation Power: 0
I wanted to see the files just out of curiousity. actually I was really thinking of any Class created not just Time.

Lets say I have a rails app and I created 2 Class's with the name "Jasper". If there were a name collision I'd like to find the Class that a specific object was created from.

No I would never mess with ruby's source code. If I did recompiling the source would be pretty easy though.

Thanks for the reply

Reply With Quote
  #8  
Old May 19th, 2008, 04:54 PM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 642 L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level)L7Sqr User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 12 h 48 m 20 sec
Reputation Power: 102
Send a message via AIM to L7Sqr
You can easily see what is loaded at any point.
Examine the following example
Code:
irb(main):001:0> $".each { |x| puts x }
e2mmap.rb
irb/init.rb
irb/workspace.rb
irb/context.rb
irb/extend-command.rb
irb/output-method.rb
irb/notifier.rb
...
irb/locale.rb
irb.rb
irb(main):002:0> require 'time'
=> true
irb(main):003:0> $".each { |x| puts x }
e2mmap.rb
irb/init.rb
irb/workspace.rb
irb/context.rb
irb/extend-command.rb
irb/output-method.rb
irb/notifier.rb
...
irb/locale.rb
irb.rb
rational.rb
date/format.rb
parsedate.rb
time.rb
Notice the differences.
Above, I use teh variable $" to get at those values. However, that does not tell you where they may be loaded from. In order to determine that, you would have to use $:.
Hope that helps.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesRuby Programming > What file does the Class belong


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT