Skip to content
Newer
Older
100644 24 lines (19 sloc) 455 Bytes
b92b0ca @sferik Add User, Status, Place, Point, and Polygon classes
authored Oct 8, 2011
1 module Twitter
2 class Base
1dd37f2 @sferik Method spacing
authored Oct 17, 2011
3
6fb7b3f @sferik Implement lazy attribute setting
authored Oct 17, 2011
4 def self.lazy_attr_reader(*attributes)
5 attributes.each do |attribute|
6 class_eval <<-RUBY, __FILE__, __LINE__ + 1
7 def #{attribute}
8 @#{attribute} ||= @attributes[#{attribute.to_s.inspect}]
9 end
10 RUBY
b92b0ca @sferik Add User, Status, Place, Point, and Polygon classes
authored Oct 8, 2011
11 end
12 end
13
6fb7b3f @sferik Implement lazy attribute setting
authored Oct 18, 2011
14 def initialize(attributes = {})
15 @attributes = attributes.dup
d63d2e5 @sferik Allow [] access to methods for greater backwards compatibility
authored Oct 17, 2011
16 end
17
6fb7b3f @sferik Implement lazy attribute setting
authored Oct 18, 2011
18 def [](method)
19 self.__send__(method.to_sym)
cc1e2e4 @sferik Add #user method to Status class
authored Oct 9, 2011
20 end
1dd37f2 @sferik Method spacing
authored Oct 18, 2011
21
b92b0ca @sferik Add User, Status, Place, Point, and Polygon classes
authored Oct 8, 2011
22 end
23 end
Something went wrong with that request. Please try again.