MichaelC
MichaelC

Reputation: 357

Use simple & useful ruby methods such as basename in RubyMotion

RubyMotion does not support

require 

in code (only in RakeFile).

Is there a way to use useful classes built into Ruby but not into RubyMotion ? For instance, I'd like to be able to do a

name=Pathname.new("/path/to/some/file").basename

rather than look for Cocoa equivalent

Upvotes: 1

Views: 114

Answers (1)

Riccardo Marotti
Riccardo Marotti

Reputation: 20348

Pathname is one of those pieces of the Ruby Standard Library that are not available in RubyMotion.

You can try with MotionBundler, but I personally haven't been very lucky with that.

I'd suggest to use the Cocoa equivalent. Something like:

name = "/path/to/some/file".lastPathComponent

Not that bad, anyway.

Upvotes: 2

Related Questions