module Wptemplates::Utils
Public Instance Methods
fixpoint(options = {}) { |cur| ... }
click to toggle source
# File lib/wptemplates/utils.rb, line 27 def fixpoint options = {} clone = options[:clone] || false cur = options[:start] begin pre = clone && !cur.nil? ? cur.clone : cur cur = yield(cur) end while cur != pre cur end
normalize_link(string, anchor = false)
click to toggle source
# File lib/wptemplates/utils.rb, line 5 def normalize_link string, anchor = false normalized = string.clone normalized.tr!('_',' ') normalized.strip! normalized.squeeze!(' ') normalized[0] = normalized[0,1].upcase unless anchor normalized end
normalize_linklabel(string)
click to toggle source
# File lib/wptemplates/utils.rb, line 14 def normalize_linklabel string normalized = string.clone normalized.strip! normalized.squeeze!(' ') normalized end
symbolize(string)
click to toggle source
# File lib/wptemplates/utils.rb, line 21 def symbolize string symbolized = normalize_link(string) symbolized.tr!(' ','_') symbolized.downcase.to_sym end