Class: GoogleVisualr::DataTable::Cell
- Inherits:
-
Object
- Object
- GoogleVisualr::DataTable::Cell
- Includes:
- ParamHelpers
- Defined in:
- lib/google_visualr/data_table.rb
Instance Attribute Summary collapse
-
#f ⇒ Object
formatted.
-
#p ⇒ Object
properties.
-
#v ⇒ Object
value.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Cell
constructor
A new instance of Cell.
- #to_js ⇒ Object
Methods included from ParamHelpers
#js_parameters, #stringify_keys!, #typecast
Constructor Details
#initialize(*args) ⇒ Cell
Returns a new instance of Cell.
259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/google_visualr/data_table.rb', line 259 def initialize(*args) = args.pop if .is_a?(Hash) @v = [:v] @f = [:f] @p = [:p] else @v = end end |
Instance Attribute Details
#f ⇒ Object
formatted
256 257 258 |
# File 'lib/google_visualr/data_table.rb', line 256 def f @f end |
#p ⇒ Object
properties
257 258 259 |
# File 'lib/google_visualr/data_table.rb', line 257 def p @p end |
#v ⇒ Object
value
255 256 257 |
# File 'lib/google_visualr/data_table.rb', line 255 def v @v end |
Instance Method Details
#to_js ⇒ Object
271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/google_visualr/data_table.rb', line 271 def to_js return "null" if @v.nil? && @f.nil? && @p.nil? js = "{" js << "v: #{typecast(@v)}" js << ", f: #{typecast(@f)}" unless @f.nil? js << ", p: #{typecast(@p)}" unless @p.nil? js << "}" js end |