Sha256: cf1a20e2a59cc3f8964c31d99777607f7cf33b63ceea8f766ba89e7d693ae69d

Contents?: true

Size: 258 Bytes

Versions: 5

Compression:

Stored size: 258 Bytes

Contents

module StringExtensions
  def titlecase
    self.gsub(/((?:^|\s)[a-z])/) { $1.upcase }
  end
  
  def to_name(last_part = '')
    self.underscore.gsub('/', ' ').humanize.titlecase.gsub(/\s*#{last_part}$/, '')
  end
end

String.send :include, StringExtensions

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-0.6.1 lib/plugins/string_extensions/lib/string_extensions.rb
radiant-0.6.0 lib/plugins/string_extensions/lib/string_extensions.rb
radiant-0.6.2 lib/plugins/string_extensions/lib/string_extensions.rb
radiant-0.6.3 lib/plugins/string_extensions/lib/string_extensions.rb
radiant-0.6.4 lib/plugins/string_extensions/lib/string_extensions.rb