Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
-diff --git a/lib/common/models/wp_user.rb b/lib/common/models/wp_user.rb index fe14e7b5..44e8fe34 100755 --- a/lib/common/models/wp_user.rb +++ b/lib/common/models/wp_user.rb @@ -18,7 +18,7 @@ class WpUser < WpItem end end - # @param [ Wpuser ] other + # @param [ WpUser ] other def <=>(other) id <=> other.id end diff --git a/lib/common/models/wp_user/existable.rb b/lib/common/models/wp_user/existable.rb index c1731585..0412db17 100755 --- a/lib/common/models/wp_user/existable.rb +++ b/lib/common/models/wp_user/existable.rb @@ -3,13 +3,22 @@ class WpUser < WpItem module Existable + # @param [ Typhoeus::Response ] response + # @param [ Hash ] options + # + # @return [ Boolean ] def exists_from_response?(response, options = {}) - load_login_from_response(response) + load_from_response(response) @login ? true : false end - def load_login_from_response(response) + # Load the login and display_name from the response + # + # @param [ Typhoeus::Response ] response + # + # @return [ void ] + def load_from_response(response) if response.code == 301 # login in location? location = response.headers_hash['Location'] @@ -22,11 +31,18 @@ class WpUser < WpItem @display_name = WpUser::Existable.display_name_from_body(response.body) end end + private :load_from_response + # @param [ String ] text + # + # @return [ String ] The login def self.login_from_author_pattern(text) text[%r{/author/([^/\b]+)/?}i, 1] end + # @param [ String ] body + # + # @return [ String ] The login def self.login_from_body(body) # Feed URL with Permalinks login = WpUser::Existable.login_from_author_pattern(body) @@ -39,11 +55,16 @@ class WpUser < WpItem login end + # @param [ String ] body + # + # @return [ String ] The display_name def self.display_name_from_body(body) if title_tag = body[%r{
-
-
-
-
-
- Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
-