twitter-status-bot/.gems/doc/twitter-5.11.0/rdoc/Twitter/Base.html

867 lines
36 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title>Class: Twitter::Base</title>
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
</head>
<body id="top" class="class">
<div id="metadata">
<div id="home-metadata">
<div id="home-section" class="section">
<h3 class="section-header">
<a href="../index.html">Home</a>
<a href="../index.html#classes">Classes</a>
<a href="../index.html#methods">Methods</a>
</h3>
</div>
</div>
<div id="file-metadata">
<div id="file-list-section" class="section">
<h3 class="section-header">In Files</h3>
<div class="section-body">
<ul>
<li><a href="../lib/twitter/base_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="lib/twitter/base.rb">lib/twitter/base.rb</a></li>
</ul>
</div>
</div>
</div>
<div id="class-metadata">
<!-- Parent Class -->
<div id="parent-class-section" class="section">
<h3 class="section-header">Parent</h3>
<p class="link">Object</p>
</div>
<!-- Method Quickref -->
<div id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-c-attr_reader">::attr_reader</a></li>
<li><a href="#method-c-define_attribute_method">::define_attribute_method</a></li>
<li><a href="#method-c-define_predicate_method">::define_predicate_method</a></li>
<li><a href="#method-c-define_uri_method">::define_uri_method</a></li>
<li><a href="#method-c-deprecate_attribute_method">::deprecate_attribute_method</a></li>
<li><a href="#method-c-display_uri_attr_reader">::display_uri_attr_reader</a></li>
<li><a href="#method-c-new">::new</a></li>
<li><a href="#method-c-object_attr_reader">::object_attr_reader</a></li>
<li><a href="#method-c-predicate_attr_reader">::predicate_attr_reader</a></li>
<li><a href="#method-c-uri_attr_reader">::uri_attr_reader</a></li>
<li><a href="#method-i-5B-5D">#[]</a></li>
</ul>
</div>
<!-- Included Modules -->
<div id="includes-section" class="section">
<h3 class="section-header">Included Modules</h3>
<ul class="link-list">
<li><span class="include">Memoizable</span></li>
<li><a class="include" href="Utils.html">Twitter::Utils</a></li>
</ul>
</div>
</div>
<div id="project-metadata">
<div id="classindex-section" class="section project-section">
<h3 class="section-header">Class/Module Index
<span class="search-toggle"><img src="../images/find.png"
height="16" width="16" alt="[+]"
title="show/hide quicksearch" /></span></h3>
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
<fieldset>
<legend>Quicksearch</legend>
<input type="text" name="quicksearch" value=""
class="quicksearch-field" />
</fieldset>
</form>
<ul class="link-list">
<li><a href="../Twitter.html">Twitter</a></li>
<li><a href="../Twitter/Arguments.html">Twitter::Arguments</a></li>
<li><a href="../Twitter/Base.html">Twitter::Base</a></li>
<li><a href="../Twitter/BasicUser.html">Twitter::BasicUser</a></li>
<li><a href="../Twitter/Client.html">Twitter::Client</a></li>
<li><a href="../Twitter/Configuration.html">Twitter::Configuration</a></li>
<li><a href="../Twitter/Creatable.html">Twitter::Creatable</a></li>
<li><a href="../Twitter/Cursor.html">Twitter::Cursor</a></li>
<li><a href="../Twitter/DirectMessage.html">Twitter::DirectMessage</a></li>
<li><a href="../Twitter/Entities.html">Twitter::Entities</a></li>
<li><a href="../Twitter/Entity.html">Twitter::Entity</a></li>
<li><a href="../Twitter/Entity/Hashtag.html">Twitter::Entity::Hashtag</a></li>
<li><a href="../Twitter/Entity/Symbol.html">Twitter::Entity::Symbol</a></li>
<li><a href="../Twitter/Entity/URI.html">Twitter::Entity::URI</a></li>
<li><a href="../Twitter/Entity/URI.html">Twitter::Entity::URL</a></li>
<li><a href="../Twitter/Entity/UserMention.html">Twitter::Entity::UserMention</a></li>
<li><a href="../Twitter/Enumerable.html">Twitter::Enumerable</a></li>
<li><a href="../Twitter/Error.html">Twitter::Error</a></li>
<li><a href="../Twitter/Error/AlreadyFavorited.html">Twitter::Error::AlreadyFavorited</a></li>
<li><a href="../Twitter/Error/AlreadyRetweeted.html">Twitter::Error::AlreadyRetweeted</a></li>
<li><a href="../Twitter/Error/BadGateway.html">Twitter::Error::BadGateway</a></li>
<li><a href="../Twitter/Error/BadRequest.html">Twitter::Error::BadRequest</a></li>
<li><a href="../Twitter/Error/ClientError.html">Twitter::Error::ClientError</a></li>
<li><a href="../Twitter/Error/Code.html">Twitter::Error::Code</a></li>
<li><a href="../Twitter/Error/ConfigurationError.html">Twitter::Error::ConfigurationError</a></li>
<li><a href="../Twitter/Error/DuplicateStatus.html">Twitter::Error::DuplicateStatus</a></li>
<li><a href="../Twitter/Error/Forbidden.html">Twitter::Error::Forbidden</a></li>
<li><a href="../Twitter/Error/GatewayTimeout.html">Twitter::Error::GatewayTimeout</a></li>
<li><a href="../Twitter/Error/InternalServerError.html">Twitter::Error::InternalServerError</a></li>
<li><a href="../Twitter/Error/NotAcceptable.html">Twitter::Error::NotAcceptable</a></li>
<li><a href="../Twitter/Error/NotFound.html">Twitter::Error::NotFound</a></li>
<li><a href="../Twitter/Error/RequestTimeout.html">Twitter::Error::RequestTimeout</a></li>
<li><a href="../Twitter/Error/ServerError.html">Twitter::Error::ServerError</a></li>
<li><a href="../Twitter/Error/ServiceUnavailable.html">Twitter::Error::ServiceUnavailable</a></li>
<li><a href="../Twitter/Error/TooManyRequests.html">Twitter::Error::TooManyRequests</a></li>
<li><a href="../Twitter/Error/UnacceptableIO.html">Twitter::Error::UnacceptableIO</a></li>
<li><a href="../Twitter/Error/Unauthorized.html">Twitter::Error::Unauthorized</a></li>
<li><a href="../Twitter/Error/UnprocessableEntity.html">Twitter::Error::UnprocessableEntity</a></li>
<li><a href="../Twitter/Factory.html">Twitter::Factory</a></li>
<li><a href="../Twitter/Geo.html">Twitter::Geo</a></li>
<li><a href="../Twitter/Geo/Point.html">Twitter::Geo::Point</a></li>
<li><a href="../Twitter/Geo/Polygon.html">Twitter::Geo::Polygon</a></li>
<li><a href="../Twitter/GeoFactory.html">Twitter::GeoFactory</a></li>
<li><a href="../Twitter/GeoResults.html">Twitter::GeoResults</a></li>
<li><a href="../Twitter/Identity.html">Twitter::Identity</a></li>
<li><a href="../Twitter/Language.html">Twitter::Language</a></li>
<li><a href="../Twitter/List.html">Twitter::List</a></li>
<li><a href="../Twitter/Media.html">Twitter::Media</a></li>
<li><a href="../Twitter/Media/Photo.html">Twitter::Media::Photo</a></li>
<li><a href="../Twitter/MediaFactory.html">Twitter::MediaFactory</a></li>
<li><a href="../Twitter/Metadata.html">Twitter::Metadata</a></li>
<li><a href="../Twitter/OEmbed.html">Twitter::OEmbed</a></li>
<li><a href="../Twitter/Place.html">Twitter::Place</a></li>
<li><a href="../Twitter/Profile.html">Twitter::Profile</a></li>
<li><a href="../Twitter/ProfileBanner.html">Twitter::ProfileBanner</a></li>
<li><a href="../Twitter/REST.html">Twitter::REST</a></li>
<li><a href="../Twitter/REST/API.html">Twitter::REST::API</a></li>
<li><a href="../Twitter/REST/Client.html">Twitter::REST::Client</a></li>
<li><a href="../Twitter/REST/DirectMessages.html">Twitter::REST::DirectMessages</a></li>
<li><a href="../Twitter/REST/Favorites.html">Twitter::REST::Favorites</a></li>
<li><a href="../Twitter/REST/FriendsAndFollowers.html">Twitter::REST::FriendsAndFollowers</a></li>
<li><a href="../Twitter/REST/Help.html">Twitter::REST::Help</a></li>
<li><a href="../Twitter/REST/Lists.html">Twitter::REST::Lists</a></li>
<li><a href="../Twitter/REST/Media.html">Twitter::REST::Media</a></li>
<li><a href="../Twitter/REST/OAuth.html">Twitter::REST::OAuth</a></li>
<li><a href="../Twitter/REST/PlacesAndGeo.html">Twitter::REST::PlacesAndGeo</a></li>
<li><a href="../Twitter/REST/Request.html">Twitter::REST::Request</a></li>
<li><a href="../Twitter/REST/Request/MultipartWithFile.html">Twitter::REST::Request::MultipartWithFile</a></li>
<li><a href="../Twitter/REST/Response.html">Twitter::REST::Response</a></li>
<li><a href="../Twitter/REST/Response/ParseErrorJson.html">Twitter::REST::Response::ParseErrorJson</a></li>
<li><a href="../Twitter/REST/Response/ParseJson.html">Twitter::REST::Response::ParseJson</a></li>
<li><a href="../Twitter/REST/Response/RaiseError.html">Twitter::REST::Response::RaiseError</a></li>
<li><a href="../Twitter/REST/SavedSearches.html">Twitter::REST::SavedSearches</a></li>
<li><a href="../Twitter/REST/Search.html">Twitter::REST::Search</a></li>
<li><a href="../Twitter/REST/SpamReporting.html">Twitter::REST::SpamReporting</a></li>
<li><a href="../Twitter/REST/SuggestedUsers.html">Twitter::REST::SuggestedUsers</a></li>
<li><a href="../Twitter/REST/Timelines.html">Twitter::REST::Timelines</a></li>
<li><a href="../Twitter/REST/Trends.html">Twitter::REST::Trends</a></li>
<li><a href="../Twitter/REST/Tweets.html">Twitter::REST::Tweets</a></li>
<li><a href="../Twitter/REST/Undocumented.html">Twitter::REST::Undocumented</a></li>
<li><a href="../Twitter/REST/Users.html">Twitter::REST::Users</a></li>
<li><a href="../Twitter/REST/Utils.html">Twitter::REST::Utils</a></li>
<li><a href="../Twitter/RateLimit.html">Twitter::RateLimit</a></li>
<li><a href="../Twitter/Relationship.html">Twitter::Relationship</a></li>
<li><a href="../Twitter/Request.html">Twitter::Request</a></li>
<li><a href="../Twitter/SavedSearch.html">Twitter::SavedSearch</a></li>
<li><a href="../Twitter/SearchResults.html">Twitter::SearchResults</a></li>
<li><a href="../Twitter/Settings.html">Twitter::Settings</a></li>
<li><a href="../Twitter/Size.html">Twitter::Size</a></li>
<li><a href="../Twitter/SourceUser.html">Twitter::SourceUser</a></li>
<li><a href="../Twitter/Streaming.html">Twitter::Streaming</a></li>
<li><a href="../Twitter/Streaming/Client.html">Twitter::Streaming::Client</a></li>
<li><a href="../Twitter/Streaming/Connection.html">Twitter::Streaming::Connection</a></li>
<li><a href="../Twitter/Streaming/DeletedTweet.html">Twitter::Streaming::DeletedTweet</a></li>
<li><a href="../Twitter/Streaming/Event.html">Twitter::Streaming::Event</a></li>
<li><a href="../Twitter/Streaming/FriendList.html">Twitter::Streaming::FriendList</a></li>
<li><a href="../Twitter/Streaming/MessageParser.html">Twitter::Streaming::MessageParser</a></li>
<li><a href="../Twitter/Streaming/Response.html">Twitter::Streaming::Response</a></li>
<li><a href="../Twitter/Streaming/StallWarning.html">Twitter::Streaming::StallWarning</a></li>
<li><a href="../Twitter/Suggestion.html">Twitter::Suggestion</a></li>
<li><a href="../Twitter/TargetUser.html">Twitter::TargetUser</a></li>
<li><a href="../Twitter/Token.html">Twitter::Token</a></li>
<li><a href="../Twitter/Trend.html">Twitter::Trend</a></li>
<li><a href="../Twitter/TrendResults.html">Twitter::TrendResults</a></li>
<li><a href="../Twitter/Tweet.html">Twitter::Tweet</a></li>
<li><a href="../Twitter/User.html">Twitter::User</a></li>
<li><a href="../Twitter/Utils.html">Twitter::Utils</a></li>
<li><a href="../Twitter/Utils/ClassMethods.html">Twitter::Utils::ClassMethods</a></li>
<li><a href="../Twitter/Version.html">Twitter::Version</a></li>
</ul>
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
</div>
</div>
</div>
<div id="documentation">
<h1 class="class">Twitter::Base</h1>
<div id="description" class="description">
</div><!-- description -->
<div id="5Buntitled-5D" class="documentation-section">
<!-- Attributes -->
<div id="attribute-method-details" class="method-section section">
<h3 class="section-header">Attributes</h3>
<div id="attrs-attribute-method" class="method-detail">
<a name="attrs"></a>
<div class="method-heading attribute-method-heading">
<span class="method-name">attrs</span><span
class="attribute-access-type">[R]</span>
</div>
<div class="method-description">
</div>
</div>
<div id="to_h-attribute-method" class="method-detail">
<a name="to_h"></a>
<div class="method-heading attribute-method-heading">
<span class="method-name">to_h</span><span
class="attribute-access-type">[R]</span>
</div>
<div class="method-description">
</div>
</div>
</div><!-- attribute-method-details -->
<!-- Methods -->
<div id="public-class-method-details" class="method-section section">
<h3 class="section-header">Public Class Methods</h3>
<div id="attr_reader-method" class="method-detail ">
<a name="method-c-attr_reader"></a>
<div class="method-heading">
<span class="method-name">attr_reader</span><span
class="method-args">(*attrs)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Define methods that retrieve the value from attributes</p>
<p>@param attrs [Array, Symbol]</p>
<div class="method-source-code" id="attr_reader-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">attr_reader</span>(*<span class="ruby-identifier">attrs</span>)
<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attr</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">define_attribute_method</span>(<span class="ruby-identifier">attr</span>)
<span class="ruby-identifier">define_predicate_method</span>(<span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- attr_reader-source -->
</div>
</div><!-- attr_reader-method -->
<div id="define_attribute_method-method" class="method-detail ">
<a name="method-c-define_attribute_method"></a>
<div class="method-heading">
<span class="method-name">define_attribute_method</span><span
class="method-args">(key1, klass = nil, key2 = nil)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Dynamically define a method for an attribute</p>
<p>@param key1 [Symbol] @param klass [Symbol] @param key2 [Symbol]</p>
<div class="method-source-code" id="define_attribute_method-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 85</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">define_attribute_method</span>(<span class="ruby-identifier">key1</span>, <span class="ruby-identifier">klass</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">key2</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">key1</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">||</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key1</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key1</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:empty?</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key1</span>].<span class="ruby-identifier">empty?</span>
<span class="ruby-constant">NullObject</span>.<span class="ruby-identifier">new</span>
<span class="ruby-keyword">else</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key1</span>]
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">attrs</span> = <span class="ruby-identifier">attrs_for_object</span>(<span class="ruby-identifier">key1</span>, <span class="ruby-identifier">key2</span>)
<span class="ruby-constant">Twitter</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">klass</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attrs</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">memoize</span>(<span class="ruby-identifier">key1</span>)
<span class="ruby-keyword">end</span></pre>
</div><!-- define_attribute_method-source -->
</div>
</div><!-- define_attribute_method-method -->
<div id="define_predicate_method-method" class="method-detail ">
<a name="method-c-define_predicate_method"></a>
<div class="method-heading">
<span class="method-name">define_predicate_method</span><span
class="method-args">(key1, key2 = key1)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Dynamically define a predicate method for an attribute</p>
<p>@param key1 [Symbol] @param key2 [Symbol]</p>
<div class="method-source-code" id="define_predicate_method-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 116</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">define_predicate_method</span>(<span class="ruby-identifier">key1</span>, <span class="ruby-identifier">key2</span> = <span class="ruby-identifier">key1</span>)
<span class="ruby-identifier">define_method</span>(<span class="ruby-value">:&quot;#{key1}?&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">||</span>
<span class="ruby-operator">!</span><span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key2</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key2</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span>(<span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key2</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:empty?</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key2</span>].<span class="ruby-identifier">empty?</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">memoize</span>(<span class="ruby-value">:&quot;#{key1}?&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div><!-- define_predicate_method-source -->
</div>
</div><!-- define_predicate_method-method -->
<div id="define_uri_method-method" class="method-detail ">
<a name="method-c-define_uri_method"></a>
<div class="method-heading">
<span class="method-name">define_uri_method</span><span
class="method-args">(key1, key2)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Dynamically define a method for a URI</p>
<p>@param key1 [Symbol] @param key2 [Symbol]</p>
<div class="method-source-code" id="define_uri_method-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 73</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">define_uri_method</span>(<span class="ruby-identifier">key1</span>, <span class="ruby-identifier">key2</span>)
<span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">key1</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">||</span>
<span class="ruby-constant">Addressable</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key2</span>]) <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key2</span>].<span class="ruby-identifier">nil?</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">memoize</span>(<span class="ruby-identifier">key1</span>)
<span class="ruby-keyword">end</span></pre>
</div><!-- define_uri_method-source -->
</div>
</div><!-- define_uri_method-method -->
<div id="deprecate_attribute_method-method" class="method-detail ">
<a name="method-c-deprecate_attribute_method"></a>
<div class="method-heading">
<span class="method-name">deprecate_attribute_method</span><span
class="method-args">(key)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Dynamically define a method for an attribute</p>
<p>@param key [Symbol]</p>
<div class="method-source-code" id="deprecate_attribute_method-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 104</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deprecate_attribute_method</span>(<span class="ruby-identifier">key</span>)
<span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">key</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">||</span>
<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;#{Kernel.caller.first}: [DEPRECATION] ##{key} is deprecated. Use ##{key}? instead.&quot;</span>
<span class="ruby-ivar">@attrs</span>[<span class="ruby-identifier">key</span>]
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">memoize</span>(<span class="ruby-identifier">key</span>)
<span class="ruby-keyword">end</span></pre>
</div><!-- deprecate_attribute_method-source -->
</div>
</div><!-- deprecate_attribute_method-method -->
<div id="display_uri_attr_reader-method" class="method-detail ">
<a name="method-c-display_uri_attr_reader"></a>
<div class="method-heading">
<span class="method-name">display_uri_attr_reader</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Define display_uri attribute methods</p>
<div class="method-source-code" id="display_uri_attr_reader-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 62</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">display_uri_attr_reader</span>
<span class="ruby-identifier">define_attribute_method</span>(<span class="ruby-value">:display_url</span>)
<span class="ruby-identifier">alias_method</span>(<span class="ruby-value">:display_uri</span>, <span class="ruby-value">:display_url</span>)
<span class="ruby-identifier">define_predicate_method</span>(<span class="ruby-value">:display_uri</span>, <span class="ruby-value">:display_url</span>)
<span class="ruby-identifier">alias_method</span>(<span class="ruby-value">:display_url?</span>, <span class="ruby-value">:display_uri?</span>)
<span class="ruby-keyword">end</span></pre>
</div><!-- display_uri_attr_reader-source -->
</div>
</div><!-- display_uri_attr_reader-method -->
<div id="new-method" class="method-detail ">
<a name="method-c-new"></a>
<div class="method-heading">
<span class="method-name">new</span><span
class="method-args">(attrs = {})</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Initializes a new object</p>
<p>@param attrs [Hash] @return [Twitter::Base]</p>
<div class="method-source-code" id="new-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 128</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attrs</span> = {})
<span class="ruby-ivar">@attrs</span> = <span class="ruby-identifier">attrs</span> <span class="ruby-operator">||</span> {}
<span class="ruby-keyword">end</span></pre>
</div><!-- new-source -->
</div>
</div><!-- new-method -->
<div id="object_attr_reader-method" class="method-detail ">
<a name="method-c-object_attr_reader"></a>
<div class="method-heading">
<span class="method-name">object_attr_reader</span><span
class="method-args">(klass, key1, key2 = nil)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Define object methods from attributes</p>
<p>@param klass [Symbol] @param key1 [Symbol] @param key2 [Symbol]</p>
<div class="method-source-code" id="object_attr_reader-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">object_attr_reader</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">key1</span>, <span class="ruby-identifier">key2</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-identifier">define_attribute_method</span>(<span class="ruby-identifier">key1</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">key2</span>)
<span class="ruby-identifier">define_predicate_method</span>(<span class="ruby-identifier">key1</span>)
<span class="ruby-keyword">end</span></pre>
</div><!-- object_attr_reader-source -->
</div>
</div><!-- object_attr_reader-method -->
<div id="predicate_attr_reader-method" class="method-detail ">
<a name="method-c-predicate_attr_reader"></a>
<div class="method-heading">
<span class="method-name">predicate_attr_reader</span><span
class="method-args">(*attrs)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="predicate_attr_reader-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 28</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">predicate_attr_reader</span>(*<span class="ruby-identifier">attrs</span>)
<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attr</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">define_predicate_method</span>(<span class="ruby-identifier">attr</span>)
<span class="ruby-identifier">deprecate_attribute_method</span>(<span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- predicate_attr_reader-source -->
</div>
</div><!-- predicate_attr_reader-method -->
<div id="uri_attr_reader-method" class="method-detail ">
<a name="method-c-uri_attr_reader"></a>
<div class="method-heading">
<span class="method-name">uri_attr_reader</span><span
class="method-args">(*attrs)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Define URI methods from attributes</p>
<p>@param attrs [Array, Symbol]</p>
<div class="method-source-code" id="uri_attr_reader-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 48</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">uri_attr_reader</span>(*<span class="ruby-identifier">attrs</span>)
<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri_key</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">array</span> = <span class="ruby-identifier">uri_key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'_'</span>)
<span class="ruby-identifier">index</span> = <span class="ruby-identifier">array</span>.<span class="ruby-identifier">index</span>(<span class="ruby-string">'uri'</span>)
<span class="ruby-identifier">array</span>[<span class="ruby-identifier">index</span>] = <span class="ruby-string">'url'</span>
<span class="ruby-identifier">url_key</span> = <span class="ruby-identifier">array</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">'_'</span>).<span class="ruby-identifier">to_sym</span>
<span class="ruby-identifier">define_uri_method</span>(<span class="ruby-identifier">uri_key</span>, <span class="ruby-identifier">url_key</span>)
<span class="ruby-identifier">alias_method</span>(<span class="ruby-identifier">url_key</span>, <span class="ruby-identifier">uri_key</span>)
<span class="ruby-identifier">define_predicate_method</span>(<span class="ruby-identifier">uri_key</span>, <span class="ruby-identifier">url_key</span>)
<span class="ruby-identifier">alias_method</span>(<span class="ruby-value">:&quot;#{url_key}?&quot;</span>, <span class="ruby-value">:&quot;#{uri_key}?&quot;</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- uri_attr_reader-source -->
</div>
</div><!-- uri_attr_reader-method -->
</div><!-- public-class-method-details -->
<div id="public-instance-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="5B-5D-method" class="method-detail ">
<a name="method-i-5B-5D"></a>
<div class="method-heading">
<span class="method-name">[]</span><span
class="method-args">(method)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Fetches an attribute of an object using hash notation</p>
<p>@param method [String, Symbol] Message to send to the object</p>
<div class="method-source-code" id="5B-5D-source">
<pre>
<span class="ruby-comment"># File lib/twitter/base.rb, line 135</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">method</span>)
<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;#{Kernel.caller.first}: [DEPRECATION] #[#{method.inspect}] is deprecated. Use ##{method} to fetch the value.&quot;</span>
<span class="ruby-identifier">send</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_sym</span>)
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMethodError</span>
<span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- 5B-5D-source -->
</div>
</div><!-- 5B-5D-method -->
</div><!-- public-instance-method-details -->
</div><!-- 5Buntitled-5D -->
</div><!-- documentation -->
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
Rdoc Generator</a> 2</small>.</p>
</div>
</body>
</html>