module Dopstick::Refinements

Public Instance Methods

camelize() click to toggle source
# File lib/dopstick/refinements.rb, line 10
def camelize
  split("-")
    .map {|word| word.split("_").map(&:capitalize).join }
    .join("::")
end
presence() click to toggle source
# File lib/dopstick/refinements.rb, line 6
def presence
  empty? ? nil : self
end
underscore(separator = "/") click to toggle source
# File lib/dopstick/refinements.rb, line 16
def underscore(separator = "/")
  split("::")
    .map {|word| word.gsub(/([A-Z]+)/m, "_\\1")[1..-1] }
    .join(separator)
    .downcase
end