Class: Rufus::RTM::TagArray
- Inherits:
-
Object
- Object
- Rufus::RTM::TagArray
- Includes:
- Enumerable
- Defined in:
- lib/rufus/rtm/resources.rb
Overview
An array of tasks.
Instance Method Summary collapse
- #<<(tag) ⇒ Object
- #clear ⇒ Object
- #delete(tag) ⇒ Object
- #each ⇒ Object
-
#initialize(task, tags) ⇒ TagArray
constructor
A new instance of TagArray.
- #join(s) ⇒ Object
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, ) @task = task @tags = if .is_a?(Array) else ['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 |
#clear ⇒ Object
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 |
#each ⇒ Object
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 |