Class: Flickry::Tag

Inherits:
String
  • Object
show all
Defined in:
lib/flickry/tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ Tag

Returns a new instance of Tag.



4
5
6
7
8
9
10
# File 'lib/flickry/tag.rb', line 4

def initialize(tag)
  super(tag.to_s)
  @tag_id       = tag.id
  @machine_tag  = tag.machine_tag
  @author_id    = tag.author
  @name         = self.to_s
end

Instance Attribute Details

#author_idObject (readonly)

Returns the value of attribute author_id.



3
4
5
# File 'lib/flickry/tag.rb', line 3

def author_id
  @author_id
end

#machine_tagObject (readonly)

Returns the value of attribute machine_tag.



3
4
5
# File 'lib/flickry/tag.rb', line 3

def machine_tag
  @machine_tag
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/flickry/tag.rb', line 3

def name
  @name
end

#tag_idObject (readonly)

Returns the value of attribute tag_id.



3
4
5
# File 'lib/flickry/tag.rb', line 3

def tag_id
  @tag_id
end

Instance Method Details

#authorObject

Get a Person record for the author_id



17
18
19
# File 'lib/flickry/tag.rb', line 17

def author
  Flickry::Person.find(@author_id)
end

#machine_tag?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/flickry/tag.rb', line 12

def machine_tag?
  @machine_tag == 0 ? false : true
end