Class: TwitterType::TypeInferrer
- Inherits:
-
Object
- Object
- TwitterType::TypeInferrer
- Defined in:
- lib/twittertypeinferrer.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
writeonly
Sets the attribute client.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
- #infer(user) ⇒ Object
-
#initialize ⇒ TypeInferrer
constructor
A new instance of TypeInferrer.
Constructor Details
#initialize ⇒ TypeInferrer
Returns a new instance of TypeInferrer.
10 11 12 |
# File 'lib/twittertypeinferrer.rb', line 10 def initialize() @client = TwitterClientWrapper.new end |
Instance Attribute Details
#client=(value) ⇒ Object (writeonly)
Sets the attribute client
7 8 9 |
# File 'lib/twittertypeinferrer.rb', line 7 def client=(value) @client = value end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
8 9 10 |
# File 'lib/twittertypeinferrer.rb', line 8 def profile @profile end |
Instance Method Details
#infer(user) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/twittertypeinferrer.rb', line 14 def infer(user) begin tweets = @client.gather_recent_tweets_for(user) @profile = ProfileFactory.new(user).build(tweets) @profile.infer_type rescue TwitterType::ProtectedUserAccessError => error @profile = ProfileFactory.new(user).build([]) @profile.inferred_type = :unknown_protected_user rescue TwitterType::InvalidUserAccessError => error @profile = ProfileFactory.new(user).build([]) @profile.inferred_type = :unknown_user end self end |