immosquare-extensions 0.1.23 → 0.1.25
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba51ed41c3634406db205a26151c6cda8219a982126e4dae21042982c2084214
|
4
|
+
data.tar.gz: bdc036cfdcc9a66e18db188482d0d4a61ed49829e64ccccde39df5932f9bfd78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2da7574722a68408c77651bbeaf8cc1489ba4973c4aa947a06ac107aa46992946cf53df46754ee3a03ad800b047f95862b83e230b909a052a0bad1f3933ae064
|
7
|
+
data.tar.gz: 69d36d4d563c8afddc27b0ba41dd4edc243b16693222970ff5c78f4f36b9c2ee41ced5a9751427e49be453d374da12a82745d78467b87f81c63a0b8286b80a87
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
module ImmosquareExtensions
|
3
|
+
module ApplicationRecord
|
4
|
+
##============================================================##
|
5
|
+
## On ajoute une méthode dig pour pouvoir accéder à des
|
6
|
+
## attributs imbriqués sans avoir à vérifier si les objets
|
7
|
+
## user.dig(:user_profile, :user_card_type, :slug)
|
8
|
+
##============================================================##
|
9
|
+
def dig(*keys)
|
10
|
+
keys.reduce(self) do |obj, key|
|
11
|
+
obj.respond_to?(key) ? obj.send(key) : nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -10,16 +10,19 @@ class String
|
|
10
10
|
## Any other value will return nil.
|
11
11
|
##
|
12
12
|
## Examples:
|
13
|
-
## "true".to_boolean
|
14
|
-
## "false".to_boolean
|
15
|
-
## "random".to_boolean
|
13
|
+
## "true".to_boolean => true
|
14
|
+
## "false".to_boolean => false
|
15
|
+
## "random".to_boolean => nil
|
16
|
+
## "random".to_boolean(true) => true
|
16
17
|
##============================================================##
|
17
|
-
def to_boolean
|
18
|
+
def to_boolean(default_value = nil)
|
18
19
|
case downcase
|
19
20
|
when "true"
|
20
21
|
true
|
21
22
|
when "false"
|
22
23
|
false
|
24
|
+
else
|
25
|
+
default_value
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
@@ -1,10 +1,27 @@
|
|
1
|
+
##============================================================##
|
2
|
+
## Shared Methods (Need to be loaded first)
|
3
|
+
##============================================================##
|
1
4
|
require_relative "immosquare-extensions/shared_methods"
|
5
|
+
|
6
|
+
##============================================================##
|
7
|
+
## Extensions
|
8
|
+
##============================================================##
|
9
|
+
require_relative "immosquare-extensions/application_record"
|
2
10
|
require_relative "immosquare-extensions/array"
|
3
11
|
require_relative "immosquare-extensions/file"
|
4
12
|
require_relative "immosquare-extensions/hash"
|
5
13
|
require_relative "immosquare-extensions/string"
|
14
|
+
|
15
|
+
##============================================================##
|
16
|
+
## Helpers
|
17
|
+
##============================================================##
|
6
18
|
require_relative "immosquare-extensions/helpers/preview_mailer_helper"
|
19
|
+
|
20
|
+
##============================================================##
|
21
|
+
## Rails
|
22
|
+
##============================================================##
|
7
23
|
require_relative "immosquare-extensions/railtie" if defined?(Rails)
|
8
24
|
|
25
|
+
|
9
26
|
module ImmosquareExtensions
|
10
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immosquare-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IMMO SQUARE
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unicode_utils
|
@@ -35,6 +35,7 @@ extensions: []
|
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
37
|
- lib/immosquare-extensions.rb
|
38
|
+
- lib/immosquare-extensions/application_record.rb
|
38
39
|
- lib/immosquare-extensions/array.rb
|
39
40
|
- lib/immosquare-extensions/file.rb
|
40
41
|
- lib/immosquare-extensions/hash.rb
|
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
63
|
- !ruby/object:Gem::Version
|
63
64
|
version: '0'
|
64
65
|
requirements: []
|
65
|
-
rubygems_version: 3.5.
|
66
|
+
rubygems_version: 3.5.11
|
66
67
|
signing_key:
|
67
68
|
specification_version: 4
|
68
69
|
summary: Utility extensions for Ruby core classes
|