class GoogleVisualr::DataTable::Cell

Attributes

f[RW]
p[RW]
v[RW]

Public Class Methods

new(options, type = nil) click to toggle source
# File lib/google_visualr/data_table.rb, line 266
def initialize(options, type = nil)
  if options.is_a?(Hash)
    @v = options[:v]
    @f = options[:f]
    @p = options[:p]
    @type = type
  else # should be a string
    @v = options
    @type = type
  end
end

Public Instance Methods

to_js() click to toggle source
# File lib/google_visualr/data_table.rb, line 278
def to_js
  return "null" if @v.nil? && @f.nil? && @p.nil?

  js  = "{"
  js << "v: #{typecast(@v, @type)}"
  js << ", f: #{typecast(@f)}"  unless @f.nil?
  js << ", p: #{typecast(@p)}"  unless @p.nil?
  js << "}"

  js
end