Class: Jiragit::Tag

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hashtag) ⇒ Tag

Returns a new instance of Tag.



7
8
9
10
# File 'lib/jiragit/tag.rb', line 7

def initialize(hashtag)
  @type = hashtag.first.first.to_sym
  @label = hashtag.first.last.to_s
end

Instance Attribute Details

#labelObject

Returns the value of attribute label.



5
6
7
# File 'lib/jiragit/tag.rb', line 5

def label
  @label
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/jiragit/tag.rb', line 5

def type
  @type
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/jiragit/tag.rb', line 24

def eql?(other)
  other.to_s.hash == to_s.hash
end

#hashObject



20
21
22
# File 'lib/jiragit/tag.rb', line 20

def hash
  to_s.hash
end

#inspectObject



16
17
18
# File 'lib/jiragit/tag.rb', line 16

def inspect
  to_s
end

#to_sObject



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

def to_s
  "#{type}: #{label}"
end