attribeauty 0.1.0 → 0.2.0
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/attribeauty/base.rb +1 -1
- data/lib/attribeauty/configuration.rb +1 -1
- data/lib/attribeauty/{cast.rb → type_caster.rb} +2 -2
- data/lib/attribeauty/version.rb +1 -1
- data/lib/attribeauty.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ff07e0947450ca0181b92fbed9438ffa4d4e063cd905dcc5148fc47e8640318
|
4
|
+
data.tar.gz: df35a5f68e745e8ab9decd67c891ca73aa4cd074cdd6695e10ec5313644d4b2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4566885478384847bdbe5965fddf3fcf2eb8bccd82782ed0da412cd77c3b89cec6f18965d4777b944313f40350e40a2a00b457af03c088aa4b33f5afc6906c91
|
7
|
+
data.tar.gz: aca7be5f1af5279ff400ea9f0220146b48b51c74e6d03e8246d13cc300a5794391e8fd3c4f7bcb2197aa0b7f3b3e091fb91a4669f3d5b33089b1fd2ef6b3f387
|
data/lib/attribeauty/base.rb
CHANGED
@@ -11,7 +11,7 @@ module Attribeauty
|
|
11
11
|
@attributes[name] = type
|
12
12
|
|
13
13
|
class_eval(<<-CODE, __FILE__, __LINE__ + 1)
|
14
|
-
def #{name}=(value); @#{name} =
|
14
|
+
def #{name}=(value); @#{name} = TypeCaster.run(value, #{type.inspect}); end
|
15
15
|
|
16
16
|
def #{name};@#{name};end
|
17
17
|
CODE
|
@@ -8,7 +8,7 @@ require_relative "types/time"
|
|
8
8
|
|
9
9
|
module Attribeauty
|
10
10
|
# base cast for types
|
11
|
-
class
|
11
|
+
class TypeCaster
|
12
12
|
BASE_TYPES = {
|
13
13
|
float: Types::Float,
|
14
14
|
integer: Types::Integer,
|
@@ -17,7 +17,7 @@ module Attribeauty
|
|
17
17
|
string: Types::String
|
18
18
|
}.freeze
|
19
19
|
|
20
|
-
def self.
|
20
|
+
def self.run(value, type)
|
21
21
|
return nil if value.nil?
|
22
22
|
|
23
23
|
all_types = Attribeauty.configuration.types
|
data/lib/attribeauty/version.rb
CHANGED
data/lib/attribeauty.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attribeauty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: There are so many of these, I just needed this one.
|
14
14
|
email:
|
@@ -26,8 +26,8 @@ files:
|
|
26
26
|
- Rakefile
|
27
27
|
- lib/attribeauty.rb
|
28
28
|
- lib/attribeauty/base.rb
|
29
|
-
- lib/attribeauty/cast.rb
|
30
29
|
- lib/attribeauty/configuration.rb
|
30
|
+
- lib/attribeauty/type_caster.rb
|
31
31
|
- lib/attribeauty/types/boolean.rb
|
32
32
|
- lib/attribeauty/types/float.rb
|
33
33
|
- lib/attribeauty/types/integer.rb
|