Class: GSGraph::Tag
- Inherits:
-
Object
- Object
- GSGraph::Tag
- Includes:
- Comparison, Serialization
- Defined in:
- lib/gs_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/gs_graph/tag.rb', line 8 def initialize(attributes = {}) @x = attributes[:x] @y = attributes[:y] if attributes[:created_time] @created_time = Time.parse(attributes[:created_time]).utc end if attributes[:id].present? @user = User.new(attributes[:id], attributes) end @name = attributes[:name] end |
Instance Attribute Details
#created_time ⇒ Object
Returns the value of attribute created_time.
6 7 8 |
# File 'lib/gs_graph/tag.rb', line 6 def created_time @created_time end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/gs_graph/tag.rb', line 6 def name @name end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/gs_graph/tag.rb', line 6 def user @user end |
#x ⇒ Object
Returns the value of attribute x.
6 7 8 |
# File 'lib/gs_graph/tag.rb', line 6 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
6 7 8 |
# File 'lib/gs_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/gs_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 |