Class: Gitlab::Ci::Tags::TagList
- Inherits:
-
Array
- Object
- Array
- Gitlab::Ci::Tags::TagList
- Defined in:
- lib/gitlab/ci/tags/tag_list.rb
Instance Attribute Summary collapse
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#parser ⇒ Object
Returns the value of attribute parser.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #<<(obj) ⇒ Object
- #add(*names) ⇒ Object
- #concat(other_tag_list) ⇒ Object
-
#initialize(*args) ⇒ TagList
constructor
A new instance of TagList.
- #remove(*names) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ TagList
Returns a new instance of TagList.
9 10 11 12 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 9 def initialize(*args) @parser = Parser add(*args) end |
Instance Attribute Details
#owner ⇒ Object
Returns the value of attribute owner.
7 8 9 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 7 def owner @owner end |
#parser ⇒ Object
Returns the value of attribute parser.
7 8 9 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 7 def parser @parser end |
Instance Method Details
#+(other) ⇒ Object
25 26 27 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 25 def +(other) TagList.new.add(self).add(other) end |
#<<(obj) ⇒ Object
21 22 23 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 21 def <<(obj) add(obj) end |
#add(*names) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 14 def add(*names) (names) concat(names) clean! self end |
#concat(other_tag_list) ⇒ Object
29 30 31 32 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 29 def concat(other_tag_list) super(other_tag_list).clean! self end |
#remove(*names) ⇒ Object
34 35 36 37 38 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 34 def remove(*names) (names) delete_if { |name| names.include?(name) } self end |
#to_s ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/gitlab/ci/tags/tag_list.rb', line 40 def to_s = frozen? ? dup : self .clean! .map do |name| name.index(',') ? "\"#{name}\"" : name end.join(', ') end |