contextuality 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,14 @@ module Contextuality
18
18
  ::Thread.main[:contextuality_defaults] ||= Contextuality::Defaults.new
19
19
  end
20
20
 
21
+ def self.logger= logger
22
+ @logger = logger
23
+ end
24
+
25
+ def self.log message
26
+ @logger.info message if @logger
27
+ end
28
+
21
29
  module ContextualityMethods
22
30
  def contextuality
23
31
  ::Thread.current.contextuality
@@ -4,11 +4,19 @@ module Contextuality
4
4
  @scopes = []
5
5
  end
6
6
 
7
+ def scope_inspect scope
8
+ scope.map do |name, value|
9
+ "#{name}: #{value.inspect}"
10
+ end.to_a.join(', ')
11
+ end
12
+
7
13
  def push variables
8
14
  @scopes.unshift Hash[variables.map { |(name, variable)| [name.to_s, variable] }]
15
+ Contextuality.log "#{'=' * @scopes.size} Entering scope: #{scope_inspect @scopes.first}"
9
16
  end
10
17
 
11
18
  def pop
19
+ Contextuality.log "#{'=' * @scopes.size} Exiting scope"
12
20
  @scopes.shift
13
21
  end
14
22
 
@@ -1,3 +1,3 @@
1
1
  module Contextuality
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contextuality
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-04 00:00:00.000000000 Z
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Contextual global variables
15
15
  email: