symbolic 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/symbolic/variable.rb +2 -9
- metadata +1 -1
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "symbolic"
|
8
|
-
gem.version = '0.1.
|
8
|
+
gem.version = '0.1.2'
|
9
9
|
gem.summary = 'Symbolic math for ruby'
|
10
10
|
gem.description = %Q{Symbolic math can be really helpful if you want to simplify some giant equation or if you don't want to get a performance hit re-evaluating big math expressions every time when few variables change.}
|
11
11
|
gem.email = "ravwar@gmail.com"
|
data/lib/symbolic/variable.rb
CHANGED
@@ -2,19 +2,12 @@ module Symbolic
|
|
2
2
|
class Variable < Operatable
|
3
3
|
attr_accessor :value, :name
|
4
4
|
|
5
|
-
@@index = 0
|
6
|
-
|
7
5
|
def initialize(options)
|
8
|
-
|
9
|
-
@@index += 1
|
10
|
-
@name = "var#{@@index}"
|
11
|
-
end
|
12
|
-
|
13
|
-
@value = options[:value]
|
6
|
+
@name, @value = options.values_at(:name, :value)
|
14
7
|
end
|
15
8
|
|
16
9
|
def to_s
|
17
|
-
@name
|
10
|
+
@name || 'unnamed_variable'
|
18
11
|
end
|
19
12
|
|
20
13
|
def undefined_variables
|