module Doing::ArrayTags

Array helpers

Public Instance Methods

highlight_tags(color = 'cyan') click to toggle source

Hightlight @tags in string for console output

@param color [String] the color to highlight with

@return [Array] Array of highlighted @tags

# File lib/doing/array/tags.rb, line 37
def highlight_tags(color = 'cyan')
  to_tags.map { |t| Doing::Color.send(color.to_sym, t) }
end
log_tags(color = 'cyan') click to toggle source

Tag array for logging

@return [String] Highlighted tag array joined with comma

# File lib/doing/array/tags.rb, line 46
def log_tags(color = 'cyan')
  highlight_tags(color).join(', ')
end
tags_to_array() click to toggle source

Convert an array of @tags to plain strings

@return [Array] array of strings without @ symbols

@example Convert an array of tags to strings [‘@one’, ‘@two’, ‘three’].to_tags => [‘one’, ‘two’, ‘three’]

# File lib/doing/array/tags.rb, line 15
def tags_to_array
  map(&:remove_at).map(&:strip)
end
to_tags() click to toggle source

Convert array of strings to array of @tags

@return [Array] Array of @tags

@example Convert an array of strings with or without @ symbols [‘one’, ‘@two’, ‘three’].to_tags => [‘@one’, ‘@two’, ‘@three’]

# File lib/doing/array/tags.rb, line 25
def to_tags
  map(&:add_at)
end