Class: D3::OrdinalScale

Inherits:
Object
  • Object
show all
Includes:
Native
Defined in:
lib/opal/d3/ordinal_scale.rb

Instance Method Summary collapse

Methods included from Native

included, #initialize

Instance Method Details

#call(t) ⇒ Object



5
6
7
# File 'lib/opal/d3/ordinal_scale.rb', line 5

def call(t)
  @native.call(t)
end

#unknown(new_value = nil) ⇒ Object

D3 is trying to reinvent Ruby symbols here



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/opal/d3/ordinal_scale.rb', line 13

def unknown(new_value=nil)
  if new_value == nil
    v = @native.JS.unknown
    if `JSON.stringify(v) === '{"name":"implicit"}'`
      :implicit
    else
      v
    end
  else
    if new_value == :implicit
      new_value = `window.d3.scaleImplicit`
    end
    @native.JS.unknown(new_value)
    self
  end
end