Class: FbGraph::Tag
- Inherits:
-
Object
- Object
- FbGraph::Tag
- Includes:
- Comparison, Serialization
- Defined in:
- lib/fb_graph/tag.rb
Instance Attribute Summary collapse
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#name ⇒ Object
Returns the value of attribute name.
-
#user ⇒ Object
Returns the value of attribute user.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Tag
constructor
A new instance of Tag.
- #to_hash(options = {}) ⇒ Object
Methods included from Serialization
Methods included from Comparison
Constructor Details
#initialize(attributes = {}) ⇒ Tag
Returns a new instance of Tag.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fb_graph/tag.rb', line 8 def initialize(attributes = {}) @x = attributes.delete(:x) @y = attributes.delete(:y) if (created_time = attributes.delete(:created_time)) @created_time = Time.parse(created_time).utc end if (identifier = attributes.delete(:id)).present? @user = User.new(identifier, attributes) end @name = attributes[:name] end |
Instance Attribute Details
#created_time ⇒ Object
Returns the value of attribute created_time.
6 7 8 |
# File 'lib/fb_graph/tag.rb', line 6 def created_time @created_time end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/fb_graph/tag.rb', line 6 def name @name end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/fb_graph/tag.rb', line 6 def user @user end |
#x ⇒ Object
Returns the value of attribute x.
6 7 8 |
# File 'lib/fb_graph/tag.rb', line 6 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
6 7 8 |
# File 'lib/fb_graph/tag.rb', line 6 def y @y end |
Instance Method Details
#to_hash(options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/fb_graph/tag.rb', line 20 def to_hash( = {}) hash = { :tag_text => self.name, :x => self.x, :y => self.y } hash[:tag_uid] = self.user.identifier if self.user hash end |