rails_extensions_core 0.0.8 → 0.0.9

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: 87e2c8735228336c4287021e9da58588ec2346ccf31cf6601396730d3531a139
4
- data.tar.gz: c040683e8114f5279f6e5b79f2f672cf6a4987d83713fd8b9c3972285ebfd34a
3
+ metadata.gz: aeb9d5d2403c6eb84351035fe68ee160888241fd9085360bc2fca32bf6228f5d
4
+ data.tar.gz: 973a311a91044a5c7bf67a5a0032f379dc5dccc8f9bc4e6be0468df14cc5da39
5
5
  SHA512:
6
- metadata.gz: 778db6419228fc3407093b79f953411a02689320494d5dda968858fbd2a9fdf4def83e97234ae9b93ec72c57345c7df29402838330b80526da429c7903bd5649
7
- data.tar.gz: 810e73d0804cfbf728c666c8405a63d665976e162faa68d81c8bbf21a90c87996752543563434cc488d04997a70cb9f640ae8731511b3bc6951941e4aedd8c00
6
+ metadata.gz: 8597ff7b90c5de17a4a3c021c4a40c050d8d7a1c7f09b7adb2b65ba23162f9726d7c5bb1429b3745a01f9d3dba63d37560effd4b4b752321de0834ef66d89d92
7
+ data.tar.gz: 6ee80e1a28564419432b2671c5cf511599625184cf5eb31276134ea875dcc2497cf9c4fd4314d8761413902c29bd233f9c60c9001f6dbe7ddae0afac92d99518
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 0.0.9 (2022-04-15)
5
+ ------------------
6
+
7
+ * Configurations weren't working
8
+
4
9
  0.0.8 (2022-04-14)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -1,75 +1,94 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'configurations'
4
-
5
3
  module RailsExtensions
6
- include Configurations
4
+ # requires all the gems
5
+ def require_gems
6
+ gem_list.each do |gem_base|
7
+ if configuration.public_send("#{flag_name(gem_base)}?")
8
+ require(gem_name(gem_base))
9
+ end
10
+ end
11
+ end
12
+
13
+ module_function :require_gems
7
14
 
8
- configurable(
9
- Boolean,
10
- include: %i[
11
- compact_map current_day current_month current_week day_of_week display_military display_user find_bang find_dupes
12
- first_dupe google_format hash_only input in_utc month_and_year month_year overlaps pipe to_bool to_dec to_i
13
- to_or_sentence to_sort_i to_x usd_to_f usd_to_i yesno logger_cycle
14
- ]
15
- )
16
- configuration_defaults do |c|
17
- c.include.compact_map = true
18
- c.include.current_day = true
19
- c.include.current_month = true
20
- c.include.current_week = true
21
- c.include.day_of_week = true
22
- c.include.display_military = true
23
- c.include.display_user = true
24
- c.include.find_bang = true
25
- c.include.find_dupes = true
26
- c.include.first_dupe = true
27
- c.include.google_format = true
28
- c.include.hash_only = true
29
- c.include.input = true
30
- c.include.in_utc = true
31
- c.include.month_and_year = true
32
- c.include.month_year = true
33
- c.include.overlaps = true
34
- c.include.pipe = true
35
- c.include.to_bool = true
36
- c.include.to_dec = true
37
- c.include.to_i = true
38
- c.include.to_or_sentence = true
39
- c.include.to_sort_i = true
40
- c.include.to_x = true
41
- c.include.usd_to_f = true
42
- c.include.usd_to_i = true
43
- c.include.yesno = true
44
- c.include.logger_cycle = true
15
+ # @return [CONFIGURATION]
16
+ def self.configuration
17
+ @configuration ||= CONFIGURATION.new
45
18
  end
46
- end
47
19
 
48
- require 'compact_map_extension' if RailsExtensions.configuration.include.compact_map
49
- require 'current_day_extension' if RailsExtensions.configuration.include.current_day
50
- require 'current_month_extension' if RailsExtensions.configuration.include.current_month
51
- require 'current_week_extension' if RailsExtensions.configuration.include.current_week
52
- require 'day_of_week_extension' if RailsExtensions.configuration.include.day_of_week
53
- require 'display_military_extension' if RailsExtensions.configuration.include.display_military
54
- require 'display_user_extension' if RailsExtensions.configuration.include.display_user
55
- require 'find_bang_extension' if RailsExtensions.configuration.include.find_bang
56
- require 'find_dupes_extension' if RailsExtensions.configuration.include.find_dupes
57
- require 'first_dupe_extension' if RailsExtensions.configuration.include.first_dupe
58
- require 'google_format_extension' if RailsExtensions.configuration.include.google_format
59
- require 'hash_only_extension' if RailsExtensions.configuration.include.hash_only
60
- require 'input_extension' if RailsExtensions.configuration.include.input
61
- require 'in_utc_extension' if RailsExtensions.configuration.include.in_utc
62
- require 'month_and_year_extension' if RailsExtensions.configuration.include.month_and_year
63
- require 'month_year_extension' if RailsExtensions.configuration.include.month_year
64
- require 'overlaps_extension' if RailsExtensions.configuration.include.overlaps
65
- require 'pipe_extension' if RailsExtensions.configuration.include.pipe
66
- require 'to_bool_extension' if RailsExtensions.configuration.include.to_bool
67
- require 'to_dec_extension' if RailsExtensions.configuration.include.to_dec
68
- require 'to_i_extension' if RailsExtensions.configuration.include.to_i
69
- require 'to_or_sentence_extension' if RailsExtensions.configuration.include.to_or_sentence
70
- require 'to_sort_i_extension' if RailsExtensions.configuration.include.to_sort_i
71
- require 'to_x_extension' if RailsExtensions.configuration.include.to_x
72
- require 'usd_to_f_extension' if RailsExtensions.configuration.include.usd_to_f
73
- require 'usd_to_i_extension' if RailsExtensions.configuration.include.usd_to_i
74
- require 'yesno_extension' if RailsExtensions.configuration.include.yesno
75
- require 'logger_cycle_extension' if RailsExtensions.configuration.include.logger_cycle
20
+ # @yield [Configuration]
21
+ def self.configure
22
+ yield(configuration)
23
+ end
24
+
25
+ private
26
+
27
+ # @return [Symbol] the flag name
28
+ def flag_name(gem_base)
29
+ :"include_#{gem_base}"
30
+ end
31
+
32
+ module_function :flag_name
33
+
34
+ # @return [String] the gem name
35
+ def gem_name(gem_base)
36
+ "#{gem_base}_extension"
37
+ end
38
+
39
+ module_function :gem_name
40
+
41
+ BOOLEAN_GEMS = %i[
42
+ compact_map
43
+ current_day
44
+ current_month
45
+ current_week
46
+ day_of_week
47
+ display_military
48
+ display_user
49
+ find_bang
50
+ find_dupes
51
+ first_dupe
52
+ google_format
53
+ hash_only
54
+ input
55
+ in_utc
56
+ month_and_year
57
+ month_year
58
+ overlaps
59
+ pipe
60
+ to_bool
61
+ to_dec
62
+ to_i
63
+ to_or_sentence
64
+ to_sort_i
65
+ to_x
66
+ usd_to_f
67
+ usd_to_i
68
+ yesno
69
+ ].freeze
70
+
71
+ # @return [Array<Symbol>] the list of gems
72
+ def gem_list
73
+ BOOLEAN_GEMS
74
+ end
75
+
76
+ module_function :gem_list
77
+
78
+ CONFIGURATION = Struct.new(*gem_list.map(&method(:flag_name))) do
79
+ members.each do |gem_member|
80
+ define_method(:"#{gem_member}?") do
81
+ public_send(gem_member) != false
82
+ end
83
+ end
84
+
85
+ # Sets all flags to true by default
86
+ def initialize
87
+ super
88
+
89
+ members.each do |gem_member|
90
+ public_send("#{gem_member}=", true)
91
+ end
92
+ end
93
+ end
94
+ end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_extensions_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Wyatt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-14 00:00:00.000000000 Z
11
+ date: 2022-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: configurations
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 2.2.2
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 2.2.2
27
- - !ruby/object:Gem::Dependency
28
- name: logger_cycle_extension
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.0.1
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 0.0.1
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: compact_map_extension
43
15
  requirement: !ruby/object:Gem::Requirement