attribeauty 0.1.0 → 0.2.0

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: e210c51252c3ef22e45a6c8c2d544725a9ebfd521f34ecfcc66856eae73c1c15
4
- data.tar.gz: 9787f43ec2bb540e09e2704c1fad4a0cb5601f6af493bbfd824d4b99090f47b3
3
+ metadata.gz: 5ff07e0947450ca0181b92fbed9438ffa4d4e063cd905dcc5148fc47e8640318
4
+ data.tar.gz: df35a5f68e745e8ab9decd67c891ca73aa4cd074cdd6695e10ec5313644d4b2c
5
5
  SHA512:
6
- metadata.gz: 0c7ebda74a3daa2cd25f5ab394a6fe464ddded6f7e2111304f63087d70a0de93e62c0630d6ae6d2a36501701109f55f475d6d5eb567646245f09c840c38529c9
7
- data.tar.gz: 38ccdac185319b5999c23cfde69d971d5c294b5f0d7fccbc52394f31b1a6d8b9f432342728bd01567f339f74b0e7db2070031a25e352a12cd7490975c9d296e3
6
+ metadata.gz: 4566885478384847bdbe5965fddf3fcf2eb8bccd82782ed0da412cd77c3b89cec6f18965d4777b944313f40350e40a2a00b457af03c088aa4b33f5afc6906c91
7
+ data.tar.gz: aca7be5f1af5279ff400ea9f0220146b48b51c74e6d03e8246d13cc300a5794391e8fd3c4f7bcb2197aa0b7f3b3e091fb91a4669f3d5b33089b1fd2ef6b3f387
@@ -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} = Cast.cast(value, #{type.inspect}); end
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 @@ module Attribeauty
8
8
  attr_accessor :types
9
9
 
10
10
  def initialize
11
- @types = Cast::BASE_TYPES.dup
11
+ @types = TypeCaster::BASE_TYPES.dup
12
12
  end
13
13
  end
14
14
  end
@@ -8,7 +8,7 @@ require_relative "types/time"
8
8
 
9
9
  module Attribeauty
10
10
  # base cast for types
11
- class Cast
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.cast(value, type)
20
+ def self.run(value, type)
21
21
  return nil if value.nil?
22
22
 
23
23
  all_types = Attribeauty.configuration.types
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Attribeauty
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/attribeauty.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "attribeauty/version"
4
4
  require_relative "attribeauty/base"
5
- require_relative "attribeauty/cast"
5
+ require_relative "attribeauty/type_caster"
6
6
  require_relative "attribeauty/configuration"
7
7
  require "date"
8
8
  require "time"
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.1.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-09 00:00:00.000000000 Z
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