rubymotion-community / sugarcube

Some sugar for your cocoa. RubyMotion helpers.
Other
422 stars 66 forks source link

NSAttributedString error #123

Closed ducky427 closed 10 years ago

ducky427 commented 10 years ago

Hi, I am new to Rubymotion and its ecosystem. I wanted to use sugarcube's wrapper on NSAttributedString. So I installed it via Bundler.

But I am unable to use it. Even in the rubymotion repl when I type:

'test'.bold

I get this error

(main)> 'test'.bold
2014-02-26 15:55:12.550 my_app[37452:80b] undefined method `bold' for "test":String (NoMethodError)
=> #<NoMethodError: undefined method `bold' for "test":String>

Am I doing something wrong?

Thanks!

colinta commented 10 years ago

You probably have to include the 'attributedstring' package. SugarCube is broken into smaller packages, so you can pick and choose what extensions you include.

    require 'sugarcube'  # you always need this one     require 'sugarcube-attributedstring'  # this will include the '.bold' method on the NSString/String class.

If you want to include MOST of the packages, you can include 'sugarcube-classic'.

HTH!

Colin T.A. Gray

@colinta colinta.com github.com/colinta

On February 26, 2014 at 8:55:39 AM, Ducky (notifications@github.com) wrote:

Hi, I am new to Rubymotion and its ecosystem. I wanted to use sugarcube's wrapper on NSAttributedString. So I installed it via Bundler.

But I am unable to use it. Even in the rubymotion repl when I type:

'test'.bold I get this error

(main)> 'test'.bold 2014-02-26 15:55:12.550 my_app[37452:80b] undefined method bold' for "test":String (NoMethodError) => #<NoMethodError: undefined methodbold' for "test":String>

Am I doing something wrong?

Thanks!

— Reply to this email directly or view it on GitHub.

ducky427 commented 10 years ago

Thanks a lot. That works exactly as you say. I should have read the documentation properly.

Cheers!