I hate to leave things dangling - so, I suppose this is the best way
to use twitter-text ruby gem, as the twitter-text provides a Twitter
module layout  -

# Extraction
class MyClass
  attr_accessor :usernames
  def initialize
    @usernames = "Mentioning @biz and @jack"    
  end
end

$KCODE = 'u'
require 'rubygems'
require 'twitter-text'

include Twitter::Extractor
p = MyClass.new
puts extract_mentioned_screen_names( p.usernames )


On Sun, Apr 11, 2010 at 6:34 PM, Patrick Kennedy <kenned...@gmail.com> wrote:
> Actually, I can make it work like this -
>
> require 'rubygems'
> require 'lib/extractor'
> require 'lib/regex'
>
> include Twitter::Extractor
> usernames = extract_mentioned_screen_names("Mentioning @twitter and @jack")
> puts usernames
> # usernames = ["twitter", "jack"]
>
> But I want to use classes like this -
>
> require 'rubygems'
> require 'unicode'
> $KCODE = 'KU'
> require 'twitter-text'
>
> class MyClass
>    include Twitter::Extractor
>    usernames = extract_mentioned_screen_names("Mentioning @twitter and @jack")
>    puts usernames
> end
>
> m = MyClass.new
>
>
>
> On Sun, Apr 11, 2010 at 5:37 PM, Patrick <kenned...@gmail.com> wrote:
>>
>> The twitter open source code looks simple and fun -
>>
>> http://github.com/mzsanford/twitter-text-rb
>>
>> However, it seems I need to install unicode support.  On Linux, I was
>> able to, though on Windows 7, I don't have nmake (don't have C++).
>> Anyways, it still complains about setting $KCODE to utf8 or u (or
>> using the -KU command line switch).  I tried both but can't seem to
>> make it work.  Which gem do I need for unicode, and how can I set it
>> programmatically?
>>
>> I tried ideas like this:
>>
>> require 'rubygems'
>> require 'unicode'
>> $KCODE = 'KU'
>>
>>
>> --
>> To unsubscribe, reply using "remove me" as the subject.
>>
>

Reply via email to