Sha256: ee84c6fd1b48fbdeac4b04e6bdb6928d743b0bcc2f0fc53ec70770917e695511
Contents?: true
Size: 611 Bytes
Versions: 1
Compression:
Stored size: 611 Bytes
Contents
require 'json' module Upperkut module Util def to_underscore(object) klass_name = object klass_name.gsub!(/::/, '_') klass_name.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2') klass_name.gsub!(/([a-z\d])([A-Z])/,'\1_\2') klass_name.tr!("-", "_") klass_name.downcase! klass_name end def encode_json_items(items) items = items.collect do |i| JSON.generate( 'enqueued_at' => Time.now.to_i, 'body' => i ) end end def decode_json_items(items) items.collect {|i| JSON.parse(i) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
upperkut-0.1.2 | lib/upperkut/util.rb |