Class: GraphViz::Types::SplineType

Inherits:
Common show all
Defined in:
lib/graphviz/types/spline_type.rb

Constant Summary collapse

FLOAT_MASK =
/[-+]?(?:[0-9]*\.[0-9]+|[0-9]+)/
ENDP_MASK =
/e\s*,\s*#{FLOAT_MASK}\s*,\s*#{FLOAT_MASK}/
STARTP_MASK =
/s\s*,\s*#{FLOAT_MASK}\s*,\s*#{FLOAT_MASK}/
POINT_MASK =
/#{FLOAT_MASK}\s*,\s*#{FLOAT_MASK}(?:\s*,\s*#{FLOAT_MASK})?!?/
TRIPLE_MASK =
/#{POINT_MASK}\s+#{POINT_MASK}\s+#{POINT_MASK}/
SPLINE_MASK =
/(?:#{ENDP_MASK}\s+)?(?:#{STARTP_MASK}\s+)?#{POINT_MASK}(?:\s*#{TRIPLE_MASK})+/
FINAL_SPLINE_MASK =
/^#{SPLINE_MASK}(?:\s*;\s*#{SPLINE_MASK})*$/
FINAL_POINT_MASK =
/^#{POINT_MASK}$/

Instance Method Summary collapse

Methods inherited from Common

#initialize, #source

Constructor Details

This class inherits a constructor from GraphViz::Types::Common

Instance Method Details

#check(data) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/graphviz/types/spline_type.rb', line 29

def check(data)
  unless SPLINE_MASK.match(data).nil?
     @is_spline = true
     return data
  end
  unless FINAL_POINT_MASK.match(data).nil?
     @is_spline = false
     return data
  end
  return nil if data.empty?

  raise SplineTypeException, "Invalid spline type value"
end

#endpObject



58
59
# File 'lib/graphviz/types/spline_type.rb', line 58

def endp
end

#outputObject Also known as: to_gv, to_s



43
44
45
# File 'lib/graphviz/types/spline_type.rb', line 43

def output
  return @data.to_s.inspect.gsub( "\\\\", "\\" )
end

#pointObject



50
51
52
53
54
55
56
# File 'lib/graphviz/types/spline_type.rb', line 50

def point
  if point?
    "[#{@data}]".to_ruby
  else
    # TODO!
  end
end

#startpObject



61
62
# File 'lib/graphviz/types/spline_type.rb', line 61

def startp
end

#triplesObject



64
65
# File 'lib/graphviz/types/spline_type.rb', line 64

def triples
end