Sha256: 64042e9961f19a687db16ef09246ebe7e48c1b15df01fd5ab7931655f727c7bc

Contents?: true

Size: 558 Bytes

Versions: 16

Compression:

Stored size: 558 Bytes

Contents

class String
  # TODO: replace with better implementations
  # NOTE: strings are currently immutable in Opal, so no ! methods
  def camelize
    self.split("_").map {|s| s.capitalize }.join("")
  end
  
  def underscore
    self.scan(/[A-Z][a-z]*/).join("_").downcase
  end
  
  def pluralize
    # TODO: Temp implementation
    if self[-1] != 's'
      return self + 's'
    else
      return self
    end
  end
  
  def singularize
    # TODO: Temp implementation
    if self[-1] == 's'
      return self[0..-2]
    else
      return self
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
volt-0.4.0 lib/volt/extra_core/string.rb
volt-0.3.9 lib/volt/extra_core/string.rb
volt-0.3.8 lib/volt/extra_core/string.rb
volt-0.3.7 lib/volt/extra_core/string.rb
volt-0.3.6 lib/volt/extra_core/string.rb
volt-0.3.5 lib/volt/extra_core/string.rb
volt-0.3.4 lib/volt/extra_core/string.rb
volt-0.3.3 lib/volt/extra_core/string.rb
volt-0.3.2 lib/volt/extra_core/string.rb
volt-0.3.1 lib/volt/extra_core/string.rb
volt-0.3.0 lib/volt/extra_core/string.rb
volt-0.2.9 lib/volt/extra_core/string.rb
volt-0.2.7 lib/volt/extra_core/string.rb
volt-0.2.5 lib/volt/extra_core/string.rb
volt-0.2.4 lib/volt/extra_core/string.rb
volt-0.2.3 lib/volt/extra_core/string.rb