Module: MoveToGo::ModelHasTags

Included in:
Deal, Organization, Person
Defined in:
lib/move-to-go/model_helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



74
75
76
# File 'lib/move-to-go/model_helpers.rb', line 74

def tags
  @tags
end

Instance Method Details

#set_tag(str) ⇒ Object

Examples:

obj.set_tag("partner")


78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/move-to-go/model_helpers.rb', line 78

def set_tag(str)
    if str.nil?
        return
    end

    if !str.is_a?(String)
        return
    end

    if str.length == 0
        return
    end
    
    @tags = [] if @tags == nil
    if ! @tags.any? {|tag| tag.value == str }
        @tags.push(Tag.new(str))
    end
end