birkirb-acts_as_serializable 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{acts_as_serializable}
5
- s.version = "0.1.5"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Birkir A. Barkarson"]
9
- s.date = %q{2009-06-16}
9
+ s.date = %q{2009-06-18}
10
10
  s.description = %q{Easy versioning of serialization methods}
11
11
  s.email = %q{birkirb@stoicviking.net}
12
12
  s.extra_rdoc_files = [
@@ -10,17 +10,31 @@ module Serializable
10
10
  base.extend(ClassMethods)
11
11
  end
12
12
 
13
+ def self.scan_rails_app_paths
14
+ if defined?(RAILS_ROOT)
15
+ # Rails plugin usage
16
+ project_paths = Array.new
17
+ $LOAD_PATH.each do |path|
18
+ if path.match(/#{Regexp.escape(RAILS_ROOT)}.*\/app$/)
19
+ project_paths << path
20
+ end
21
+ end
22
+ project_paths
23
+ else
24
+ Array.new
25
+ end
26
+ end
27
+
28
+ SERIALIZATION_PROJECT_PATHS = Serializable.scan_rails_app_paths
29
+
13
30
  module ClassMethods
14
31
  def acts_as_serializable
15
32
  include Serializable::InstanceMethods
16
33
  extend Serializable::SingletonMethods
17
34
  @serialization_versions = Versions.new
18
35
  find_local_serialization_methods
19
- if defined?(RAILS_ROOT)
20
- # Rails plugin usage
21
- scan_rails_app_paths.each do |path|
22
- find_project_serialization_classes(path)
23
- end
36
+ SERIALIZATION_PROJECT_PATHS.each do |path|
37
+ find_project_serialization_classes(path)
24
38
  end
25
39
  end
26
40
  end
@@ -76,16 +90,6 @@ module Serializable
76
90
  EOV
77
91
  @serialization_versions << Version.new(method_version)
78
92
  end
79
-
80
- def scan_rails_app_paths
81
- project_paths = Array.new
82
- $LOAD_PATH.each do |path|
83
- if path.match(/#{Regexp.escape(RAILS_ROOT)}.*\/app$/)
84
- project_paths << path
85
- end
86
- end
87
- project_paths
88
- end
89
93
  end
90
94
 
91
95
  # This module contains instance methods
@@ -38,9 +38,6 @@ class TestModel
38
38
  find_project_serialization_classes(File.join(File.dirname(__FILE__)))
39
39
  end
40
40
 
41
- ::RAILS_ROOT = File.join(File.dirname(__FILE__))
42
- $LOAD_PATH.push(File.join(::RAILS_ROOT, 'app'))
43
-
44
41
  class TestRailsModel
45
42
  include Serializable
46
43
  acts_as_serializable
@@ -1,6 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'spec'
3
3
 
4
+ ::RAILS_ROOT = File.join(File.dirname(__FILE__))
5
+ $LOAD_PATH.push(File.join(::RAILS_ROOT, 'app'))
6
+
4
7
  require 'lib/serializable/version'
5
8
  require 'lib/serializable/versions'
6
9
  require 'lib/acts_as_serializable'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birkirb-acts_as_serializable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Birkir A. Barkarson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-16 00:00:00 -07:00
12
+ date: 2009-06-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency