Numeric degree and radian method aliases

Moderator: Jim

Numeric degree and radian method aliases

Postby Dan Rathbun » Thu Aug 29, 2013 10:06 pm

The following has been requested by one of my customers:

Code: Select all
class Numeric # open class for editing:

  alias_method(:deg2rad,:degrees) unless method_defined?(:deg2rad)

  alias_method(:rad2deg,:radians) unless method_defined?(:rad2deg)

end # class Numeric


They like using the "2" to mean "to"... but would the REAL Ruby way be more like:
deg_to_rad and rad_to_deg ??

:?:
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    Re: Numeric degree and radian method aliases

    Postby TIG » Thu Aug 29, 2013 10:10 pm

    Yes.

    But both naming conventions work, so why not make them both...
    They can use the one they prefer - 'the customer is always right' [even when they are wrong!]
    0
    TIG
    User avatar
    TIG 
    Global Moderator
     

    Re: Numeric degree and radian method aliases

    Postby tt_su » Tue Sep 03, 2013 9:18 am

    Modifying the core classes would not pass the moderation at the Extension Warehouse.
    1
    User avatar
    tt_su 
    SketchUp Team
    SketchUp Team
     

    Re: Numeric degree and radian method aliases

    Postby Dan Rathbun » Tue Sep 03, 2013 2:34 pm

    tt_su wrote:Modifying the core classes would not pass the moderation at the Extension Warehouse.

    I know.. I post here as a HINT, that the current names for the methods are not intuitive.

    Aliases would be appreciated in a future API release.
    0
      I'm not here much anymore. But a PM will fire email notifications.
      User avatar
      Dan Rathbun 
      PluginStore Author
      PluginStore Author
       

      SketchUcation One-Liner Adverts

      by Ad Machine » 5 minutes ago



      Ad Machine 
      Robot
       



       

      Return to Skx Extension Library

      Who is online

      Users browsing this forum: No registered users and 1 guest

      Visit our sponsors: