yiffspace 0.0.17 → 0.0.19
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 +4 -4
- data/lib/yiffspace/concerns/user_class_methods.rb +32 -0
- data/lib/yiffspace/config_builder.rb +7 -4
- data/lib/yiffspace/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4fff71908d1a591b74a70087e31f22faae879bfad1b4a9a33f4259ea048e9ce
|
|
4
|
+
data.tar.gz: 148f054836f39b9f9c56d00c41f3437507f3a0bf66b7c2c12ff831366d19de54
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 470f74913ae4f8262be2c2df1be822920e95b231a5398c20c160db93bf60410693af5082817727de3f9a06ac28f87012eeab590f0eae69ba110b79721e703c38
|
|
7
|
+
data.tar.gz: 1b812a80a4ab84ed8796ef0fbca5d072f99ff7543bcfc84cd33806eac67f8527cfd90568ea38c18295119b3f95f0f5aed5565ee248d2f460117a72131d015c86
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YiffSpace
|
|
4
|
+
module Concerns
|
|
5
|
+
# methods to include into the user class for use with the like/resolvable classes
|
|
6
|
+
module UserClassMethods
|
|
7
|
+
extend(ActiveSupport::Concern)
|
|
8
|
+
|
|
9
|
+
def resolvable(ip_addr = nil)
|
|
10
|
+
YiffSpace.config.user_resolvable_class.new(self, ip_addr || "127.0.0.1")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def resolve
|
|
14
|
+
self
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def ==(other)
|
|
18
|
+
return super if other.is_a?(YiffSpace.config.user_class)
|
|
19
|
+
|
|
20
|
+
other.is_a?(YiffSpace.config.user_resolvable_class) && super(other.user)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def ===(other)
|
|
24
|
+
other == YiffSpace.config.user_like_class || super
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def is_a?(other)
|
|
28
|
+
other == YiffSpace.config.user_like_class || super
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require("active_support/hash_with_indifferent_access")
|
|
4
|
+
|
|
3
5
|
# This is intended to only be used externally, it is NOT reusable, do not use it within this project, or attempt to use it multiple times!!
|
|
4
6
|
module YiffSpace
|
|
5
7
|
class ConfigBuilder
|
|
6
8
|
include(Singleton)
|
|
7
9
|
|
|
8
10
|
cattr_accessor(:list, default: [])
|
|
9
|
-
cattr_accessor(:env_set, default:
|
|
11
|
+
cattr_accessor(:env_set, default: ActiveSupport::HashWithIndifferentAccess.new)
|
|
10
12
|
cattr_accessor(:unset, default: [])
|
|
11
13
|
cattr_accessor(:required, default: [])
|
|
12
|
-
cattr_accessor(:reviver_map, default:
|
|
13
|
-
cattr_accessor(:subconfigs, default:
|
|
14
|
+
cattr_accessor(:reviver_map, default: ActiveSupport::HashWithIndifferentAccess.new)
|
|
15
|
+
cattr_accessor(:subconfigs, default: ActiveSupport::HashWithIndifferentAccess.new { |h, k| h[k] = {} })
|
|
14
16
|
cattr_accessor(:env_name, default: "CONFIG")
|
|
15
17
|
|
|
16
18
|
def self.config(name, type = :string, env: true, required: false, blank: false, &block)
|
|
@@ -61,6 +63,7 @@ module YiffSpace
|
|
|
61
63
|
end
|
|
62
64
|
|
|
63
65
|
def self.reviver(name, type = nil, &block)
|
|
66
|
+
name = name.to_sym
|
|
64
67
|
if block
|
|
65
68
|
reviver_map[name] = block
|
|
66
69
|
return
|
|
@@ -68,7 +71,7 @@ module YiffSpace
|
|
|
68
71
|
method = case type
|
|
69
72
|
when :boolean
|
|
70
73
|
->(v) { !v.match?(/\A(false|f|no|n|off|0)\z/i) }
|
|
71
|
-
when :integer
|
|
74
|
+
when :integer, :number
|
|
72
75
|
->(v) { v.to_i }
|
|
73
76
|
when :symbol
|
|
74
77
|
->(v) { v.to_sym }
|
data/lib/yiffspace/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yiffspace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Donovan_DMC
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-07-03 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: abbrev
|
|
@@ -139,6 +139,7 @@ files:
|
|
|
139
139
|
- lib/yiffspace/concerns/conditional_includes.rb
|
|
140
140
|
- lib/yiffspace/concerns/current_methods.rb
|
|
141
141
|
- lib/yiffspace/concerns/has_bit_flags.rb
|
|
142
|
+
- lib/yiffspace/concerns/user_class_methods.rb
|
|
142
143
|
- lib/yiffspace/concerns/user_methods.rb
|
|
143
144
|
- lib/yiffspace/concerns/user_name_methods.rb
|
|
144
145
|
- lib/yiffspace/concerns/user_resolvable_methods.rb
|