module CukeSalad::Codify::ConstName

Public Class Methods

from(sentence) click to toggle source
# File lib/cukesalad/codify/const_name.rb, line 4
def ConstName.from sentence
  joined_together capitalised( words_from sentence )
end

Private Class Methods

capitalised(words) click to toggle source
# File lib/cukesalad/codify/const_name.rb, line 18
def ConstName.capitalised words
  words.collect{ | word | word.capitalize }
end
joined_together(words) click to toggle source
# File lib/cukesalad/codify/const_name.rb, line 9
def ConstName.joined_together words
  words.join
end
words_from(this_sentence) click to toggle source
# File lib/cukesalad/codify/const_name.rb, line 13
def ConstName.words_from this_sentence
  on_word_boundary = /\s|([A-Z][a-z]+)/
  this_sentence.split( on_word_boundary )
end