Class: Class
Instance Method Summary collapse
-
#class_leaf_name ⇒ Object
Returns the class name without the module names that precede it.
Instance Method Details
#class_leaf_name ⇒ Object
Returns the class name without the module names that precede it. I’m sure there’s a builtin way to do this, but I couldn’t find it and this works just as reliably! Examples:
-
Quickbooks::Qbxml::Request.class_leaf_name # => ‘Request’
-
Quickbooks::Customer.class_leaf_name # => ‘Customer’
51 52 53 |
# File 'lib/quickbooks/ruby_magic.rb', line 51 def class_leaf_name self.name[self.parent.name.length+2,self.name.length-self.parent.name.length-2] end |