class DataPoint

Constants

CRITERIA
DEFAULT_SHAPE
OVERLAY

Public Class Methods

configure_shape_criteria(*matchers) click to toggle source
   # File lib/SVG/Graph/DataPoint.rb
11 def DataPoint.configure_shape_criteria(*matchers)
12   CRITERIA.push(*matchers)
13 end
new(x, y, line) click to toggle source
   # File lib/SVG/Graph/DataPoint.rb
18 def initialize(x, y, line)
19   @x = x
20   @y = y
21   @line = line
22 end
reset_shape_criteria() click to toggle source
   # File lib/SVG/Graph/DataPoint.rb
14 def DataPoint.reset_shape_criteria
15   CRITERIA.clear
16 end

Public Instance Methods

shape(description=nil) click to toggle source
   # File lib/SVG/Graph/DataPoint.rb
23 def shape(description=nil)
24   shapes = CRITERIA.select {|criteria|
25     criteria.size == 2
26   }.collect {|regexp, proc|
27     proc.call(@x, @y, @line) if description =~ regexp
28   }.compact
29   shapes = [DEFAULT_SHAPE.call(@x, @y, @line)] if shapes.empty?
30 
31   overlays = CRITERIA.select { |criteria|
32     criteria.last == OVERLAY
33   }.collect { |regexp, proc|
34     proc.call(@x, @y, @line) if description =~ regexp
35   }.compact
36 
37   return shapes + overlays
38 end