Sha256: 94acb634aeea68a1e5ef69aa6270b6cea5ba6a7f1688535cd3b06c02b04ddd17

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

AmCharts.RB.Util = {
  Class: {
    create: function(block) {
      function klass() {
        this.initialize.apply(this, arguments);
      }

      klass.prototype = block || {};
      if (!klass.prototype.initialize) klass.prototype.initialize = function() {}
      klass.prototype.constructor = klass;
      return klass;
    }
  },

  try_these: function()
  {
    var returnValue;

    for (var i = 0, length = arguments.length; i < length; i++)
    {
      var lambda = arguments[i];

      try
      {
        returnValue = lambda();
        break;
      }
      catch (e) { }
    }

    return returnValue;
  },

  to_query_string: function(obj, prefix)
  {
    var str = [];

    for(var p in obj)
    {
      var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p];

      str.push(typeof v == "object" ?
        AmCharts.RB.Util.to_query_string(v, k) :
        encodeURIComponent(k) + "=" + encodeURIComponent(v));
    }

    return str.join("&");
  },

  is_function: function(object)
  {
    return Object.prototype.toString.call(object) === "[object Function]";
  },

  is_empty: function(object)
  {
    if (object === null || object === undefined) return true;
    if (object.length !== undefined) return object.length == 0;
    return undefined;
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
amcharts.rb-3.4.7.5 app/assets/javascripts/amcharts/util.js
amcharts.rb-3.4.7.4 app/assets/javascripts/amcharts/util.js
amcharts.rb-3.4.7.3 app/assets/javascripts/amcharts/util.js
amcharts.rb-3.4.7.2 app/assets/javascripts/amcharts/util.js
amcharts.rb-3.4.7.1 app/assets/javascripts/amcharts/util.js