Sha256: 786fb0ff671d7fdbcdf2c822a6201cf7eb60e4c3dbef7ac1e797cdcd18a7c0fa
Contents?: true
Size: 732 Bytes
Versions: 1
Compression:
Stored size: 732 Bytes
Contents
class String def jsonify if self.index('_') == 0 # '_some_string' should become '_someString' and not 'SomeString' '_' + self[1..-1].camelize(:lower) else self.camelize(:lower) end end # Converts self to "literal JSON"-string - one that doesn't get quotes appended when being sent "to_json" method def l ActiveSupport::JSON::Variable.new(self) end # removes JS-comments (both single- and multi-line) from the string def strip_js_comments regexp = /\/\/.*$|(?m:\/\*.*?\*\/)/ self.gsub!(regexp, '') # also remove empty lines regexp = /^\s*\n/ self.gsub!(regexp, '') end # "false" => false, "whatever_else" => true def to_b self != "false" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
netzke-core-0.7.7 | lib/netzke/core_ext/string.rb |