module TumblrThemer::TagHelper::InstanceMethods
Public Instance Methods
block(name)
click to toggle source
# File lib/tumblr-themer/tag_helper.rb, line 9 def block name instance_exec(self,&blk) end
boolify(val)
click to toggle source
# File lib/tumblr-themer/tag_helper.rb, line 13 def boolify val if !val false elsif val.respond_to?(:empty?) && val.empty? false else true end end
camelize(term)
click to toggle source
File activesupport/lib/active_support/inflector/methods.rb, line 55
# File lib/tumblr-themer/tag_helper.rb, line 35 def camelize(term) string = term.to_s string = string.sub(/^[a-z\d]*/) { $&.capitalize } string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::') end
tag(name)
click to toggle source
# File lib/tumblr-themer/tag_helper.rb, line 3 def tag name blk = self.class.tags[name] instance_exec(self,&blk) end
underscore(camel_cased_word)
click to toggle source
File activesupport/lib/active_support/inflector/methods.rb, line 77
# File lib/tumblr-themer/tag_helper.rb, line 24 def underscore(camel_cased_word) word = camel_cased_word.to_s.dup word.gsub!(/::/, '/') word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2') word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') word.tr!("-", "_") word.downcase! word end