Class: MilkCap::RTM::TagArray

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/milk_cap/rtm/resources.rb

Overview

An array of tasks.

Instance Method Summary collapse

Constructor Details

#initialize(task, tags) ⇒ TagArray

TODO introduce method to return state change between clean & dirty tags in order to use addTags or removeTags instead of just setTags.



271
272
273
274
# File 'lib/milk_cap/rtm/resources.rb', line 271

def initialize (task, tags)
  @dirty = false
  @prev = @tags = tags
end

Instance Method Details

#<<(tag) ⇒ Object



283
284
285
286
# File 'lib/milk_cap/rtm/resources.rb', line 283

def << (tag)
  @tags << tag
  self.dirty!
end

#clearObject



293
294
295
296
297
# File 'lib/milk_cap/rtm/resources.rb', line 293

def clear

  @tags.clear
  self.dirty!
end

#delete(tag) ⇒ Object



288
289
290
291
# File 'lib/milk_cap/rtm/resources.rb', line 288

def delete (tag)
  @tags.delete tag
  self.dirty!
end

#dirty!Object



280
# File 'lib/milk_cap/rtm/resources.rb', line 280

def dirty!; self.dirty=true; end

#dirty=(dirty_state) ⇒ Object



276
277
278
279
# File 'lib/milk_cap/rtm/resources.rb', line 276

def dirty=(dirty_state)
  @dirty = dirty_state
  @prev = @tags if !dirty_state
end

#dirty?Boolean

Returns:

  • (Boolean)


281
# File 'lib/milk_cap/rtm/resources.rb', line 281

def dirty?; @dirty; end

#eachObject



303
304
305
# File 'lib/milk_cap/rtm/resources.rb', line 303

def each
  @tags.each { |e| yield e }
end

#join(s) ⇒ Object



299
300
301
# File 'lib/milk_cap/rtm/resources.rb', line 299

def join (s)
  @tags.join(s)
end