rVM 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,9 +15,9 @@ module RVM
15
15
  else
16
16
  @value = "#{value}".to_f
17
17
  end
18
- if @value.to_f == @value.to_i
19
- @value = @value.to_i
20
- end
18
+ #if @value.to_f == @value.to_i
19
+ # @value = @value.to_i
20
+ #end
21
21
  end
22
22
 
23
23
  def == v
data/lib/rvm/functions.rb CHANGED
@@ -41,7 +41,7 @@ module RVM
41
41
  p
42
42
  end if not signature.empty?
43
43
  r = execute(params, env)
44
- RVM::debug "#{self.inspect}: #{signature.inspect} = '#{r}'"
44
+ RVM::debug "#{self.inspect}: #{signature.inspect} = '#{r}'" if $DEBUG
45
45
  r
46
46
  end
47
47
 
@@ -11,7 +11,7 @@ module RVM
11
11
 
12
12
  # This is a helper fuctio to quickly generate a empty enviorment.
13
13
  def Interpreter.env aenv = {}
14
- RVM::debug "Interpreter.env"
14
+ RVM::debug "Interpreter.env" if $DEBUG
15
15
  Enviroment.new aenv
16
16
  end
17
17
 
@@ -57,8 +57,8 @@ module RVM
57
57
  :params => []
58
58
  }.merge(init_data)
59
59
  @prev = oldenv || {}
60
- RVM::debug "data: #{data}\noldenv:#{oldenv}"
61
- RVM::debug "Creating new enviroment with: #{@data.inspect} as child of #{@prev}"
60
+ RVM::debug "data: #{data}\noldenv:#{oldenv}" if $DEBUG
61
+ RVM::debug "Creating new enviroment with: #{@data.inspect} as child of #{@prev}" if $DEBUG
62
62
  end
63
63
 
64
64
  #allows raw access to the data, be carefull!
@@ -72,7 +72,7 @@ module RVM
72
72
  # If the current enviroment does not have the given paramenter it tries
73
73
  # it's 'oldenv' attrib to see if that had a object.
74
74
  def param i
75
- RVM::debug "Getting param #{i} (#{@data[:params][i]})"
75
+ RVM::debug "Getting param #{i} (#{@data[:params][i]})" if $DEBUG
76
76
  @data[:params][i] || @prev.param(i)
77
77
  end
78
78
 
@@ -85,7 +85,7 @@ module RVM
85
85
  # Use +read_var_val+ if you want to read the value of a variable.
86
86
  def [] k
87
87
  r = @data[:locals][k] || @prev[k]
88
- RVM::debug "Getting variable #{k} (#{r})"
88
+ RVM::debug "Getting variable #{k} (#{r})" if $DEBUG
89
89
  r
90
90
  end
91
91
 
@@ -97,7 +97,7 @@ module RVM
97
97
  # in upper enviroments.
98
98
  def []= k, v
99
99
  #TODO: add capability to have the privious env variables changed
100
- RVM::debug "Setting variable #{k} to #{v}"
100
+ RVM::debug "Setting variable #{k} to #{v}" if $DEBUG
101
101
  if (r = self[k])
102
102
  r.val = v
103
103
  else
@@ -118,7 +118,7 @@ module RVM
118
118
  if not r and @prev.is_a? Enviroment
119
119
  r = @prev.function(k)
120
120
  end
121
- RVM::debug "Getting functon #{k} (#{r})"
121
+ RVM::debug "Getting functon #{k} (#{r})" if $DEBUG
122
122
  r
123
123
  end
124
124
 
@@ -128,7 +128,7 @@ module RVM
128
128
  def def_function k, b
129
129
  raise(ArgumentError, "Function definitions must be of block class.") if not b.is_a?(RVM::Classes::Block)
130
130
  @data[:functions][k] = b
131
- RVM::debug "Setting functon #{k} (#{b})"
131
+ RVM::debug "Setting functon #{k} (#{b})" if $DEBUG
132
132
  nil
133
133
  end
134
134
 
@@ -142,7 +142,7 @@ module RVM
142
142
  else
143
143
  r = RVM::Classes[:error].new(0, "Variable #{name} is not defined.")
144
144
  end
145
- RVM::debug "Getting variable value #{name} (#{r})"
145
+ RVM::debug "Getting variable value #{name} (#{r})" if $DEBUG
146
146
  r
147
147
  end
148
148
  end
@@ -288,7 +288,7 @@ module RVM
288
288
  end
289
289
 
290
290
  def execute env
291
- RVM::debug "Executing Constant at #{@pos}: #{@value}"
291
+ RVM::debug "Executing Constant at #{@pos}: #{@value}" if $DEBUG
292
292
  @value
293
293
  end
294
294
  end
@@ -340,10 +340,10 @@ module RVM
340
340
  def execute env
341
341
  v = @value.execute(env)
342
342
  if v and v.is_true?
343
- RVM::debug "Executing Condition... (true)"
343
+ RVM::debug "Executing Condition... (true)" if $DEBUG
344
344
  @true_case.execute env
345
345
  elsif @false_case
346
- RVM::debug "Executing Condition... (false)"
346
+ RVM::debug "Executing Condition... (false)" if $DEBUG
347
347
  @false_case.execute env
348
348
  end
349
349
  end
@@ -366,7 +366,7 @@ module RVM
366
366
  end
367
367
 
368
368
  def execute env
369
- RVM::debug "Executing Assignment at #{@pos}..."
369
+ RVM::debug "Executing Assignment at #{@pos}..." if $DEBUG
370
370
  env[@name.execute(env).to_s] = @value.execute env
371
371
  end
372
372
  end
@@ -388,13 +388,13 @@ module RVM
388
388
  end
389
389
 
390
390
  def execute env
391
- RVM::debug "Executing Variable at #{@pos}..."
391
+ RVM::debug "Executing Variable at #{@pos}..." if $DEBUG
392
392
  n = @name
393
393
  if not @name.is_a?(Symbol)
394
394
  n = n.execute(env).to_s
395
395
  end
396
396
  r = env.read_var_val(n)
397
- #@type = r.data_type if r
397
+ @type = r.data_type if r.respond_to?(:data_type)
398
398
  r
399
399
  end
400
400
  end
@@ -415,7 +415,7 @@ module RVM
415
415
  end
416
416
 
417
417
  def execute env
418
- RVM::debug "Executing Parameter at #{@pos}..."
418
+ RVM::debug "Executing Parameter at #{@pos}..." if $DEBUG
419
419
  r = env.param(@num.execute(env).to_i)
420
420
  @type = r.data_type if r
421
421
  r
@@ -427,10 +427,9 @@ module RVM
427
427
  # The type of the squence is equal to the last element of the sequence.
428
428
  class Sequence < Array
429
429
  def execute env
430
- RVM::debug "Executing Sequence... #{inspect}"
430
+ RVM::debug "Executing Sequence... #{inspect}" if $DEBUG
431
431
  r = nil
432
432
  self.map { |seq|
433
- RVM::debug "Executing Sequence step..."
434
433
  r = seq.execute env
435
434
  }
436
435
  r
@@ -508,7 +507,7 @@ module RVM
508
507
  end
509
508
 
510
509
  def execute env
511
- RVM::debug "Executing FunctionCall..."
510
+ RVM::debug "Executing FunctionCall..." if $DEBUG
512
511
  args = @arguments.dup
513
512
  if @function.is_a? RVM::Classes[:block]
514
513
  args.map! do |arg|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rVM
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heinz N. Gies
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-11 00:00:00 +02:00
12
+ date: 2008-07-12 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15