institutions 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
- Gemfile.lock
1
+ Gemfile.lock
2
+ pkg/
data/lib/institutions.rb CHANGED
@@ -5,17 +5,17 @@ module Institutions
5
5
  require_rel 'institutions'
6
6
 
7
7
  # Default paths/files for the module.
8
- DEFAULT_LOADPATHS = [
9
- (defined?(Rails) and Rails.root) ?
10
- "#{Rails.root}/config" : "./config" ]
11
- DEFAULT_FILENAMES = ["institutions.yml"]
8
+ DEFAULT_LOADPATH = "./config"
9
+ DEFAULT_FILENAME = "institutions.yml"
12
10
 
13
11
  def self.loadpaths
14
- @loadpaths ||= DEFAULT_LOADPATHS.dup
12
+ @loadpaths ||=
13
+ [(defined?(::Rails) and ::Rails.version >= '3.0.1' ) ?
14
+ "#{Rails.root}/config" : DEFAULT_LOADPATH]
15
15
  end
16
16
 
17
17
  def self.filenames
18
- @filenames ||= DEFAULT_FILENAMES.dup
18
+ @filenames ||= [DEFAULT_FILENAME]
19
19
  end
20
20
 
21
21
  # Intended for internal use only.
@@ -58,7 +58,7 @@ module Institutions
58
58
  # Institutions.loadpaths << File.join("path", "to", "new", "load", "directory")
59
59
  # To manipulate file name order and/or add file names
60
60
  # Institutions.filenames << "newfile.yml"
61
- #
61
+ #
62
62
  def self.institutions
63
63
  unless @institutions
64
64
  raise NameError.new("No load path was specified.") if loadpaths.nil?
@@ -71,7 +71,7 @@ module Institutions
71
71
  # Merge the new elements or add a new Institution
72
72
  @institutions.has_key?(code) ?
73
73
  @institutions[code].merge(elements) :
74
- @institutions[code] =
74
+ @institutions[code] =
75
75
  Institution.new(code, elements["name"] ? elements["name"] : code, elements)
76
76
  end
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module Institutions
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -4,9 +4,9 @@ class InstitutionsTest < Test::Unit::TestCase
4
4
  def setup
5
5
  # Undo any instance variable settings.
6
6
  Institutions.send(:instance_variable_set, :@loadpaths, nil)
7
- assert_equal(Institutions::DEFAULT_LOADPATHS, Institutions.loadpaths)
7
+ assert_equal([Institutions::DEFAULT_LOADPATH], Institutions.loadpaths)
8
8
  Institutions.send(:instance_variable_set, :@filenames, nil)
9
- assert_equal(Institutions::DEFAULT_FILENAMES, Institutions.filenames)
9
+ assert_equal([Institutions::DEFAULT_FILENAME], Institutions.filenames)
10
10
  Institutions.send(:instance_variable_set, :@institutions, nil)
11
11
  assert_nil(Institutions.send(:instance_variable_get, :@institutions))
12
12
  end
@@ -16,9 +16,9 @@ class InstitutionsTest < Test::Unit::TestCase
16
16
  end
17
17
 
18
18
  def test_path
19
- assert_equal Institutions::DEFAULT_LOADPATHS, Institutions.loadpaths
19
+ assert_equal [Institutions::DEFAULT_LOADPATH], Institutions.loadpaths
20
20
  Institutions.loadpaths << File.join("../config")
21
- assert_equal Institutions::DEFAULT_LOADPATHS.concat(["../config"]), Institutions.loadpaths
21
+ assert_equal [Institutions::DEFAULT_LOADPATH, "../config"], Institutions.loadpaths
22
22
  end
23
23
 
24
24
  def test_institutions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: institutions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-11-10 00:00:00.000000000 Z
12
+ date: 2012-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: require_all
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  version: '0'
144
144
  segments:
145
145
  - 0
146
- hash: -78613404009586632
146
+ hash: -332144587236410515
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  none: false
149
149
  requirements:
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  segments:
154
154
  - 0
155
- hash: -78613404009586632
155
+ hash: -332144587236410515
156
156
  requirements: []
157
157
  rubyforge_project:
158
158
  rubygems_version: 1.8.24