tarvit-helpers 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 583ebf7a45701497936225588f6ab46602c48f53
4
- data.tar.gz: 9e067d9cc8738a543a1f5fd1922facd1a45e12d7
3
+ metadata.gz: 6a0689eff17cb747296cbc6aabac0de42c2d6115
4
+ data.tar.gz: 28ac7328ed54ba691223d5bcffbb400a98186247
5
5
  SHA512:
6
- metadata.gz: 14461dccef0afb53e1e9553f9bf64a54c512bf77abe9be617ba3abb60187b1ed4ca08abf047b362dc57117b65f502313478bb2228f7f8ad1ca578bfbb36ece7f
7
- data.tar.gz: 08ae705c034318d31c549c1bb1490ce88ed28a6e3e82e2eb3ea95f979fb4b34685d4d2fd87c34b4f7c5db2de9b66b16f27620beb07e5bf166239accb025d7662
6
+ metadata.gz: b6059e3ed688aa294b00ee78fa705d9ee101ec803d165122312f71649823bf758cca977da62ff6c22ecdcf260d7fa658516e67c1ba37520c02d9e090cf781e75
7
+ data.tar.gz: c3bc4add0489c7b6ea02407efc4b8def5d3440a5d1d53bd5d78df13fe9ba211d706f0b9e3b38f00591686a217e67dbd35920a3839b4411b35a1f390210c89ef3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -0,0 +1,42 @@
1
+ module TarvitHelpers
2
+ module NonSharedAccessors
3
+ require 'active_support'
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+ def non_shared_cattr_accessor(*keys)
8
+ keys.each do |key|
9
+ raise "#{key} is not a Symbol" unless key.is_a?(Symbol)
10
+ method=<<METHOD
11
+ def #{key}
12
+ get_non_shared(:#{ key })
13
+ end
14
+
15
+ def #{key}=(v)
16
+ set_non_shared(:#{ key },v)
17
+ end
18
+ METHOD
19
+ eval(method)
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def global_shared_store
26
+ @global_shared_values ||= {}
27
+ end
28
+
29
+ def own_store
30
+ global_shared_store[self] ||= {}
31
+ end
32
+
33
+ def get_non_shared(key)
34
+ own_store[key]
35
+ end
36
+
37
+ def set_non_shared(key,value)
38
+ own_store[key]=value
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,5 @@
1
+ module TarvitHelpers
2
+
3
+ require 'modules/non_shared_accessors'
4
+
5
+ end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: tarvit-helpers 0.0.1 ruby lib
5
+ # stub: tarvit-helpers 0.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "tarvit-helpers"
9
- s.version = "0.0.1"
9
+ s.version = "0.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
27
  "VERSION",
28
+ "lib/modules/non_shared_accessors.rb",
28
29
  "lib/tarvit-helpers.rb",
29
30
  "tarvit-helpers.gemspec",
30
31
  "test/helper.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarvit-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Tarasenko
@@ -94,6 +94,7 @@ files:
94
94
  - README.rdoc
95
95
  - Rakefile
96
96
  - VERSION
97
+ - lib/modules/non_shared_accessors.rb
97
98
  - lib/tarvit-helpers.rb
98
99
  - tarvit-helpers.gemspec
99
100
  - test/helper.rb