module TextUtils::TagHelper
Public Instance Methods
find_tags( value )
click to toggle source
-
todo: use new additional sub module ???
e.g. TextUtils::Reader::TagHelper
lets us use “classic” web helpers a la rails find a good name for sub module - Reader? Fixtures? Values? Parser?
# File lib/textutils/helper/tag_helper.rb, line 13 def find_tags( value ) # logger.debug " found tags: >>#{value}<<" tag_keys = value.split('|') ## unify; replace _w/ space; remove leading n trailing whitespace tag_keys = tag_keys.map do |key| key = key.gsub( '_', ' ' ) key = key.strip key end tag_keys # return tag keys as ary end
find_tags_in_attribs!( attribs )
click to toggle source
# File lib/textutils/helper/tag_helper.rb, line 28 def find_tags_in_attribs!( attribs ) # NB: will remove :tags from attribs hash if attribs[:tags].present? tag_keys = find_tags( attribs[:tags] ) attribs.delete(:tags) tag_keys # return tag keys as ary of strings else [] # nothing found; return empty ary end end