F1e3ab214a976a39cfd713bc93deb10f

Im sure there is a better way to do below:

# 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 !

B849433e0e1a3f4ca0cf7cc55b8acd53

Casper

November 7, 2008, November 07, 2008 05:48, permalink

No rating. Login to rate!

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"
D35bf85abbb6f72013d8a3714bcca565

does acai berry easy cleanse work

March 26, 2010, March 26, 2010 15:49, permalink

No rating. Login to rate!

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
4f730f0617dd0d670f6ee66e5c967f68

pirsingfoto401

April 16, 2011, April 16, 2011 02:14, permalink

No rating. Login to rate!

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

90c4ae7f3a88384486bfb0fa3cb426ce

PrivatePilot735

May 14, 2011, May 14, 2011 17:36, permalink

No rating. Login to rate!

No race can prosper till it learns that there is as much dignity in tilling a field as in writing a poem.

3ae6ddc650357a6fe622dc7bb5d9863d

Watches417

May 14, 2011, May 14, 2011 21:46, permalink

No rating. Login to rate!

Freedom is not worth having if it does not connote freedom to err.

31d77e64247809408a9e3ea615bd647f

CodLiverOil837

May 14, 2011, May 14, 2011 23:09, permalink

No rating. Login to rate!

Business is like riding a bicycle - either you keep moving or you fall down.

36f79d2b45d4227fbc1202f5d65a5e1d

PrivatePilot784

May 15, 2011, May 15, 2011 09:46, permalink

No rating. Login to rate!

Lies have short legs.

Bf6795b2a112e3096f780adc74479058

FishOil150

May 15, 2011, May 15, 2011 16:49, permalink

No rating. Login to rate!

Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing happened.

0b7728f4c59f7c243e33e1c1f7114541

Lepnina162

May 16, 2011, May 16, 2011 00:21, permalink

No rating. Login to rate!

He who sacrifices his conscience to ambition burns a picture to obtain the ashes.

10fdca89c588e0db2bd18507ed37b830

0797 hot amateur wives

May 16, 2011, May 16, 2011 03:41, permalink

No rating. Login to rate!

The receiver is as bad as the thief.

B1e576484fda09036b44fd5ad4071d4a

Vad ar Strattera

June 5, 2011, June 05, 2011 16:17, permalink

No rating. Login to rate!


They never miss the opportunity to miss opportunity.

86521d07cdbc52ce9007c7ad986bfc46

Tadalis tabletten bestellen

June 8, 2011, June 08, 2011 10:54, permalink

No rating. Login to rate!


Experience is the best teacher. Experience is the name every one gives to his mistakes. (W. Scott)

829338d9a7a5fdd21b38675ef9731c57

eulexin

June 12, 2011, June 12, 2011 01:28, permalink

No rating. Login to rate!

Ich bin endlich, ich tue Abbitte, aber es kommt mir nicht ganz heran. Wer noch, was vorsagen kann?

6fbee0abab6a38bb096a86f436908579

antabuse

June 12, 2011, June 12, 2011 06:44, permalink

No rating. Login to rate!

It is remarkable, rather useful message

8c6a19762703c39ca017909cfd5a46df

CLOMIDONLINER

October 8, 2011, October 08, 2011 14:26, permalink

No rating. Login to rate!

<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.

Your refactoring





Format Copy from initial code

or Cancel