atom_attr_accessor 0.1.0

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.
@@ -0,0 +1,29 @@
1
+ class Class
2
+ def atom_attr_accessor(*args)
3
+ self.class_eval("
4
+ require 'java'
5
+ require 'clojure-1.5.1.jar'
6
+ java_import 'clojure.lang.LockingTransaction'
7
+ java_import 'clojure.lang.Atom'
8
+ ")
9
+
10
+ args.each do |arg|
11
+ self.class_eval("
12
+ def #{arg}
13
+ @#{arg}.deref unless @#{arg}.nil?
14
+ end
15
+
16
+ def #{arg}=(val)
17
+ if @#{arg}.nil?
18
+ @#{arg} = Atom.new(val)
19
+ else
20
+ @#{arg}.reset val
21
+ end
22
+ end
23
+ ")
24
+
25
+ end
26
+ end
27
+ end
28
+
29
+
Binary file
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: atom_attr_accessor
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Fernando Ipar
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-03-17 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Defines accessor methods for instance variables using clojure's atoms, for thread safety
15
+ email: fipar@acm.org
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/atom_attr_accessor.rb
21
+ - lib/clojure-1.5.1.jar
22
+ homepage: http://rubygems.org/gems/atom_attr_accessor
23
+ licenses:
24
+ - EPL-1.0
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: !binary |-
34
+ MA==
35
+ none: false
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: !binary |-
41
+ MA==
42
+ none: false
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.24
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: Defines accessor methods using clojure atoms
49
+ test_files: []