Skip to content

Commit

Permalink
Automatically define inquirer methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Nov 27, 2012
1 parent 13df503 commit a6da19b
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 27 deletions.
3 changes: 3 additions & 0 deletions lib/twitter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def self.attr_reader(*attrs)
define_method attribute do
@attrs[attribute.to_sym]
end
define_method "#{attribute}?" do
!!@attrs[attribute.to_sym]
end
end
end
const_set(:Attributes, mod)
Expand Down
1 change: 0 additions & 1 deletion lib/twitter/basic_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Twitter
class BasicUser < Twitter::Identity
attr_reader :following, :screen_name
alias following? following
alias handle screen_name
alias username screen_name
alias user_name screen_name
Expand Down
1 change: 0 additions & 1 deletion lib/twitter/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class List < Twitter::Identity
include Twitter::Creatable
attr_reader :description, :following, :full_name, :member_count,
:mode, :name, :slug, :subscriber_count, :uri
alias following? following

# @return [Twitter::User]
def user
Expand Down
1 change: 0 additions & 1 deletion lib/twitter/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Settings < Twitter::Base
attr_reader :always_use_https, :discoverable_by_email, :geo_enabled,
:language, :protected, :screen_name, :show_all_inline_media, :sleep_time,
:time_zone
alias protected? protected

# @return [Twitter::Place]
def trend_location
Expand Down
7 changes: 0 additions & 7 deletions lib/twitter/source_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@ module Twitter
class SourceUser < Twitter::BasicUser
attr_reader :all_replies, :blocking, :can_dm, :followed_by, :marked_spam,
:notifications_enabled, :want_retweets
alias all_replies? all_replies
alias blocking? blocking
alias can_dm? can_dm
alias followed_by? followed_by
alias marked_spam? marked_spam
alias notifications_enabled? notifications_enabled
alias want_retweets? want_retweets
end
end
1 change: 0 additions & 1 deletion lib/twitter/target_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
module Twitter
class TargetUser < Twitter::BasicUser
attr_reader :followed_by
alias followed_by? followed_by
end
end
5 changes: 1 addition & 4 deletions lib/twitter/tweet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ class Tweet < Twitter::Identity
:profile_image_url_https, :repliers, :retweeted, :retweeters, :source,
:text, :to_user, :to_user_id, :to_user_name, :truncated
alias in_reply_to_tweet_id in_reply_to_status_id
alias favorited? favorited
alias favourited favorited
alias favourited? favorited
alias favourited? favorited?
alias favouriters favoriters
alias retweeted? retweeted
alias truncated? truncated

# @return [Boolean]
def entities?
Expand Down
13 changes: 1 addition & 12 deletions lib/twitter/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,20 @@ class User < Twitter::BasicUser
:profile_sidebar_fill_color, :profile_text_color,
:profile_use_background_image, :protected, :statuses_count, :time_zone,
:url, :utc_offset, :verified
alias contributors_enabled? contributors_enabled
alias default_profile? default_profile
alias default_profile_image? default_profile_image
alias follow_request_sent? follow_request_sent
alias favorite_count favourites_count
alias favoriters_count favourites_count
alias favorites_count favourites_count
alias favourite_count favourites_count
alias favouriters_count favourites_count
alias follower_count followers_count
alias friend_count friends_count
alias geo_enabled? geo_enabled
alias is_translator? is_translator
alias notifications? notifications
alias profile_background_tile? profile_background_tile
alias profile_use_background_image? profile_use_background_image
alias protected? protected
alias status_count statuses_count
alias translator is_translator
alias translator? is_translator
alias translator? is_translator?
alias tweet_count statuses_count
alias tweets_count statuses_count
alias update_count statuses_count
alias updates_count statuses_count
alias verified? verified

# Return the URL to the user's profile banner image
#
Expand Down

0 comments on commit a6da19b

Please sign in to comment.