familia 2.0.0.pre3 → 2.0.0.pre4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5d32d5a95de13ddda788d37390fb97e7a73c5ff1b80515bf55f2db16d18a211
4
- data.tar.gz: b5a97154c4f4461de329d5190b239b0db135304ce2b36e59d226f8b37ade5614
3
+ metadata.gz: c17c7c0fbd21ec7edf380a157f36bcf50632838c083474ac56291653e5e5b5f2
4
+ data.tar.gz: 496226f45b28c48a20f4a7c0901e45f048407b53cb80d4d373f5840f06673bd5
5
5
  SHA512:
6
- metadata.gz: e51b2929601c71ed5fc33465fc39732fdae070c44427af3352de73e4f5b1ae14af6fc075a1179b5c0c197c6fe0e699c524e251ce22a33049f353f9d385495b09
7
- data.tar.gz: 3be9e23886a0c327dbbe529a683675ca2a3dc0a3c3774a1eab447f49f7949b4b9c5a82248b6fea1a0ad546eb261872e6a54f3ef6c2ebcf6df51277c0b720aeb5
6
+ metadata.gz: bfce15edc52796648eb1356be796260d8e8dae8bcba38f11a435b86cd732f73acacc8959e67d2bb3e3025d82a962e63ca2627fecb2f88dfc0e76bb1da174592d
7
+ data.tar.gz: 3cc196dc11aaf65409061ed5772043c151dfbc0fe39701b86e2808d2c9f1a55a5647f9ba22cb80cc806752ad17d41a05c2cce743fecf2258e8ff6b91f9868c12
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- familia (2.0.0.pre2)
4
+ familia (2.0.0.pre4)
5
5
  benchmark
6
6
  connection_pool
7
7
  csv
@@ -237,6 +237,20 @@ module Familia
237
237
  end
238
238
  end
239
239
 
240
+ # Converts the class name into a string that can be used to look up
241
+ # configuration values. This is particularly useful when mapping
242
+ # familia models with specific database numbers in the configuration.
243
+ #
244
+ # @example V2::Session.config_name => 'session'
245
+ #
246
+ # @return [String] The underscored class name as a string
247
+ def config_name
248
+ name.split('::').last
249
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
250
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
251
+ .downcase
252
+ end
253
+
240
254
  # Creates and persists a new instance of the class.
241
255
  #
242
256
  # @param *args [Array] Variable number of positional arguments to be passed
@@ -3,6 +3,6 @@
3
3
  module Familia
4
4
  # Version information for the Familia
5
5
  unless defined?(Familia::VERSION)
6
- VERSION = '2.0.0.pre3'
6
+ VERSION = '2.0.0.pre4'
7
7
  end
8
8
  end
@@ -1,47 +1,38 @@
1
+ # try/horreum/class_methods_try.rb
2
+
1
3
  # Test Horreum class methods
2
4
 
3
5
  require_relative '../helpers/test_helpers'
4
6
 
5
- ## create factory method with existence checking
6
- begin
7
- user_class = Class.new(Familia::Horreum) do
8
- identifier_field :email
9
- field :email
10
- field :name
11
- field :age
12
- end
13
-
14
- result = user_class.respond_to?(:create) && user_class.respond_to?(:exists?)
15
- result
16
- rescue StandardError => e
17
- false
7
+ TestUser = Class.new(Familia::Horreum) do
8
+ identifier_field :email
9
+ field :email
10
+ field :name
11
+ field :age
18
12
  end
19
- #=> true
20
13
 
21
- ## multiget method is available
22
- begin
23
- user_class = Class.new(Familia::Horreum) do
24
- identifier_field :email
25
- field :email
26
- field :name
14
+ module AnotherModuleName
15
+ AnotherTestUser = Class.new(Familia::Horreum) do
27
16
  end
28
-
29
- user_class.respond_to?(:multiget)
30
- rescue StandardError => e
31
- false
32
17
  end
33
- #=> true
18
+
19
+ ## create factory method with existence checking
20
+ TestUser
21
+ #==> _.respond_to?(:create)
22
+ #==> _.respond_to?(:exists?)
23
+
24
+ ## multiget method is available
25
+ TestUser
26
+ #==> _.respond_to?(:multiget)
34
27
 
35
28
  ## find_keys method is available
36
- begin
37
- user_class = Class.new(Familia::Horreum) do
38
- identifier_field :email
39
- field :email
40
- field :name
41
- end
29
+ TestUser
30
+ #==> _.respond_to?(:find_keys)
42
31
 
43
- user_class.respond_to?(:find_keys)
44
- rescue StandardError => e
45
- false
46
- end
47
- #=> true
32
+ ## config name turns a top-level class into a symbol
33
+ TestUser.config_name.to_sym
34
+ #=> :test_user
35
+
36
+ ## config name turns the fully qualified class into a symbol, but just the right most class
37
+ AnotherModuleName::AnotherTestUser.config_name.to_sym
38
+ #=> :another_test_user
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: familia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre3
4
+ version: 2.0.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum