Class: Rufus::RTM::TagArray

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

Overview

An array of tasks.

Instance Method Summary collapse

Constructor Details

#initialize(task, tags) ⇒ TagArray

Returns a new instance of TagArray.



285
286
287
288
289
290
291
292
293
294
# File 'lib/rufus/rtm/resources.rb', line 285

def initialize (task, tags)

  @task = task

  @tags = if tags.is_a?(Array)
    tags
  else
    tags['tag']
  end
end

Instance Method Details

#<<(tag) ⇒ Object



296
297
298
299
300
301
302
303
304
# File 'lib/rufus/rtm/resources.rb', line 296

def << (tag)

  @tags << tag

  args = prepare_api_args
  args[:tags] = tag

  @task.queue_operation('addTags', args)
end

#clearObject



316
317
318
319
320
321
322
323
324
# File 'lib/rufus/rtm/resources.rb', line 316

def clear

  @tags.clear

  args = prepare_api_args
  args[:tags] = ''

  @task.queue_operation('setTags', args)
end

#delete(tag) ⇒ Object



306
307
308
309
310
311
312
313
314
# File 'lib/rufus/rtm/resources.rb', line 306

def delete (tag)

  @tags.delete tag

  args = prepare_api_args
  args[:tags] = tag

  @task.queue_operation('removeTags', args)
end

#eachObject



331
332
333
334
# File 'lib/rufus/rtm/resources.rb', line 331

def each

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

#join(s) ⇒ Object



326
327
328
329
# File 'lib/rufus/rtm/resources.rb', line 326

def join (s)

  @tags.join(s)
end