Class: FruitToLime::Tag

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val = nil) ⇒ Tag

Returns a new instance of Tag.



10
11
12
13
14
# File 'lib/fruit_to_lime/model/tag.rb', line 10

def initialize(val=nil)
    if val
        @value = val
    end
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/fruit_to_lime/model/tag.rb', line 8

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/fruit_to_lime/model/tag.rb', line 25

def ==(other)
    if other.respond_to?(:value)
        return @value == other.value
    else
        return false
    end
end

#serialize_nameObject



4
5
6
# File 'lib/fruit_to_lime/model/tag.rb', line 4

def serialize_name
    "Tag"
end

#to_sObject



21
22
23
# File 'lib/fruit_to_lime/model/tag.rb', line 21

def to_s
    return "tag: '#{@value}'"
end

#to_xmlObject



16
17
18
19
# File 'lib/fruit_to_lime/model/tag.rb', line 16

def to_xml
    varn = serialize_name
    "<#{varn}>#{ @value.to_s.encode('utf-8').encode(:xml => :text) }</#{varn}>"
end