Class: BubbleGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/bubbler/bubble_graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ BubbleGraph

Returns a new instance of BubbleGraph.



6
7
8
9
# File 'lib/bubbler/bubble_graph.rb', line 6

def initialize args
  @name = args[:name]
  @data = args[:data]
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/bubbler/bubble_graph.rb', line 4

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/bubbler/bubble_graph.rb', line 4

def name
  @name
end

Instance Method Details

#as_d3_hashObject



15
16
17
# File 'lib/bubbler/bubble_graph.rb', line 15

def as_d3_hash
  { children: @data }
end

#to_json(options = {}) ⇒ Object



11
12
13
# File 'lib/bubbler/bubble_graph.rb', line 11

def to_json options={}
  self.as_d3_hash.to_json
end