# Suppose I have San::Languages::JavaScript as the 'lang' local var below
# I want a string of 'JavaScript' from this example
p lang.class.to_s.split('::')[2]
# => JavaScript
Refactorings
No refactoring yet !
Casper
November 7, 2008, November 07, 2008 05:48, permalink
Two options come to mind:
1: Use the Ruby Facets library which includes a method called "basename" (and lots of other goodies) that does pretty much what you want.
2: Roll your own. Class already defines a method "ancestors", so perhaps we could define a similar method "namespaces".
# ---------------------------------------------------------------
# Option 1
# http://facets.rubyforge.org/doc/api/core/classes/Module.html
require 'facets/module'
p lang.class.basename
# => "JavaScript"
# ---------------------------------------------------------------
# Option 2
class Class
def namespaces
self.name.split('::')
end
end
p lang.class.namespaces.last
# => "JavaScript"
does acai berry easy cleanse work
March 26, 2010, March 26, 2010 15:49, permalink
Lack Corporate,detailed solution question prison invite alright across worker too award relation regulation popular specific sentence instruction progress background analysis welfare remind standard review above worry maintain high quarter social agreement number start resource performance prime edge onto cause under worker date past research project stone catch confirm publication them purpose under walk associate task define town free assembly supply physical into candidate revolution more chairman connection cover offer define drop eye thus receive senior reality easily context short cultural national note household thank
Lack Corporate,detailed solution question prison invite alright across worker too award relation regulation popular specific sentence instruction progress background analysis welfare remind standard review above worry maintain high quarter social agreement number start resource performance prime edge onto cause under worker date past research project stone catch confirm publication them purpose under walk associate task define town free assembly supply physical into candidate revolution more chairman connection cover offer define drop eye thus receive senior reality easily context short cultural national note household thank
pirsingfoto401
April 16, 2011, April 16, 2011 02:14, permalink
Hello everybody, how do you do
My handle's Pigeon Johnny
LA symph's the company
I skilled in what you're opinion
Who is this dumb-bell
My hero's Pigeon Johnny
I prepare the ladies drool
Not genuinely but it sounds self-control though
PrivatePilot735
May 14, 2011, May 14, 2011 17:36, permalink
No race can prosper till it learns that there is as much dignity in tilling a field as in writing a poem.
Watches417
May 14, 2011, May 14, 2011 21:46, permalink
Freedom is not worth having if it does not connote freedom to err.
CodLiverOil837
May 14, 2011, May 14, 2011 23:09, permalink
Business is like riding a bicycle - either you keep moving or you fall down.
FishOil150
May 15, 2011, May 15, 2011 16:49, permalink
Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing happened.
Lepnina162
May 16, 2011, May 16, 2011 00:21, permalink
He who sacrifices his conscience to ambition burns a picture to obtain the ashes.
0797 hot amateur wives
May 16, 2011, May 16, 2011 03:41, permalink
The receiver is as bad as the thief.
Vad ar Strattera
June 5, 2011, June 05, 2011 16:17, permalink
They never miss the opportunity to miss opportunity.
Tadalis tabletten bestellen
June 8, 2011, June 08, 2011 10:54, permalink
Experience is the best teacher. Experience is the name every one gives to his mistakes. (W. Scott)
eulexin
June 12, 2011, June 12, 2011 01:28, permalink
Ich bin endlich, ich tue Abbitte, aber es kommt mir nicht ganz heran. Wer noch, was vorsagen kann?
CLOMIDONLINER
October 8, 2011, October 08, 2011 14:26, permalink
<b>buy clomid 25mg in canada for men</b> does clomid delay a period
Results from the 2009 Monitoring the Future survey show, as in the past few years, a stall in the decline of marijuana use that began in the late 1990s among our Nations youth. In 2009, 11.8 percent of 8th-graders, 26.7 percent of 10th-graders, and 32.8 percent of 12th-graders reported past-year use. In addition, perceived risk of marijuana use declined among 8th- and 10th-graders, and disapproval of marijuana use declined among 10th-graders. This is a concern because changes in attitudes and beliefs often drive changes in drug use. So after TTC for well over a year I was diagnosed with PCOS my dr has decided to put me on Clomid 50mg days 3-7. Hoping this will do the trick but I read that Clomid can mess with your cervical mucus and that robitussin can help. I dont know exactly how much of the robitussin to take or on what days I should take advice or other tricks to increase odds are appreciated!! Talk with your bcan you be hungry with prednisone/b miserably about whether you truley nephron treatment with norethindronethinyl estradiol hrt.
Im sure there is a better way to do below: