add_symbolic_names 0.1.2 → 0.2.0

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: 667433ef2f73aaf079324568bd098045339f2a77
4
- data.tar.gz: 37551fae79e23a8258622262d60c66b77cc3fa6f
3
+ metadata.gz: bdd00e6815c88b624d573e5716cd893c729701ac
4
+ data.tar.gz: 6710e0e21dbd704eb5d7b2df1d32bf012fd29b34
5
5
  SHA512:
6
- metadata.gz: fe2a9ca8787b0805bd2a721ee4c738f8f7124beec3e5800d3ff293694659f84125f22b13af99e1d2a54bdcfd237f18a8edf1381ee3a8e087b6fe77ef9983a210
7
- data.tar.gz: d92d9c35fcd7112cd1789c23e9022f42f5022885c5169c73ef61e695aa693ff680016bb4e9ddc5ae7d41a546f9385096563d2d4669b75c8450e86a84422cc578
6
+ metadata.gz: 7231c58f9919bcbd2cdbfc4d7533e4ec4311a0bff9abc85bad162ba555c73babd64f68ba38402edce4aa1a1e447b7172030928d3e4238ed8746ce740ecab072c
7
+ data.tar.gz: 8d15bc3a111208b554197b6cad3cace389210087b2e1c39bc129c1b4e5922d9c2ed317bacbaf69704e3c04c1604d221b99c7636a380e5c780da5739f0f87c8c0
@@ -6,10 +6,14 @@ module AddSymbolicNames
6
6
  mattr_accessor :folder
7
7
 
8
8
  def self.define_constants(klass, opts)
9
- YAML.load_file(File.join(self.folder, "#{klass.name.demodulize.tableize}.yml")).each do |datum|
9
+ YAML.load_file(yaml_file_name(klass)).each do |datum|
10
10
  klass.const_set(datum['symbolic_name'], datum['id']) unless klass.const_defined?(datum['symbolic_name'])
11
11
  end
12
12
  end
13
+
14
+ def self.yaml_file_name(klass)
15
+ File.join(self.folder, "#{klass.name.tableize}.yml")
16
+ end
13
17
  end
14
18
  end
15
- end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module AddSymbolicNames
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -19,4 +19,22 @@ class AddSymbolicNamesTest < ActiveSupport::TestCase
19
19
  assert_equal 2, User::ADMIN
20
20
  end
21
21
 
22
+ test "generates a yaml file name based off of the class name" do
23
+ class ClassWithoutModule
24
+ end
25
+ yaml_store = AddSymbolicNames::Store::Yaml
26
+
27
+ assert_equal "#{yaml_store.folder}/#{self.class.name.underscore}/class_without_modules.yml", yaml_store.yaml_file_name(ClassWithoutModule)
28
+ end
29
+
30
+ test "generates a yaml file name based off of the class name with modules" do
31
+ module SomeModule
32
+ class ClassWithModule
33
+ end
34
+ end
35
+ yaml_store = AddSymbolicNames::Store::Yaml
36
+
37
+ assert_equal "#{yaml_store.folder}/#{self.class.name.underscore}/some_module/class_with_modules.yml", yaml_store.yaml_file_name(SomeModule::ClassWithModule)
38
+ end
39
+
22
40
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: add_symbolic_names
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben VandenBos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-23 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: ActiveRecord plugin for creating constants from a domain table
@@ -44,16 +44,16 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - MIT-LICENSE
48
+ - README.md
49
+ - Rakefile
50
+ - lib/add_symbolic_names.rb
47
51
  - lib/add_symbolic_names/mixin.rb
48
52
  - lib/add_symbolic_names/railtie.rb
53
+ - lib/add_symbolic_names/store.rb
49
54
  - lib/add_symbolic_names/store/active_record.rb
50
55
  - lib/add_symbolic_names/store/yaml.rb
51
- - lib/add_symbolic_names/store.rb
52
56
  - lib/add_symbolic_names/version.rb
53
- - lib/add_symbolic_names.rb
54
- - MIT-LICENSE
55
- - Rakefile
56
- - README.md
57
57
  - test/add_symbolic_names_test.rb
58
58
  homepage: http://github.com/avvo/add_symbolic_names
59
59
  licenses:
@@ -65,17 +65,17 @@ require_paths:
65
65
  - lib
66
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.0.3
78
+ rubygems_version: 2.6.2
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: ActiveRecord plugin for creating constants from a domain table