Class: Plotty::Sequence

Inherits:
Object
  • Object
show all
Defined in:
lib/plotty/graph.rb

Defined Under Namespace

Classes: Linear, Scalar

Class Method Summary collapse

Class Method Details

.parse(command) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/plotty/graph.rb', line 46

def self.parse(command)
	case command
	when /^(.*?),(.*?)$/
		command.split(',').map(&:to_i)
	when /^(.*?):\*(.*?):(.*?)$/
		Scalar.new($1.to_i, $3.to_i, $2.to_i)
	when /^(.*?):(.*?):(.*?)$/
		Linear.new($1.to_i, $3.to_i, $2.to_i)
	when /^(.*?):(.*?)$/
		Linear.new($1.to_i, $2.to_i, 1)
	end
end