composable-core 0.0.10 → 0.0.12

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: 0f0a7631a2a50f7c71eacf731a721b4995a248a6e0219cd8f607882ebc759c1a
4
- data.tar.gz: 35551925a652a6f39fa25f28151bdd9389ceb6fd60245fbfcf69fabc2ca09bbb
3
+ metadata.gz: c96ef190ca77b40d2f3cefd876a7a9b4ebba438ba691ca2d19e0f5324d8a204b
4
+ data.tar.gz: f20b1305822b2563168c981cc31189cff9c0297361885d48a44534a64d87c022
5
5
  SHA512:
6
- metadata.gz: 457445922fc10a80cd37eddfacebfe0058aecf9e2e676c59a845b5137a2f7e21efae4a124bf98f3bf49afbd7b13cc0edeec2f26b3aa5b7dcd8a4dbaf2296a54f
7
- data.tar.gz: 20a4a8d45908d3bc87aefced546fcb5c6053a8cdd200275d3d2fcf6adacace42ea09bb795c1d00018a45f4d6a7c471c9d5d64907c114fc6eb672eed83c53f7ff
6
+ metadata.gz: 3d6aa5b78ac5e5e44d88f0a892d8cd4f041b21785ca51616e9e3e79e73472348d25361b94f3ed32464b6f8106d7b530c2cdbc2d1b475a3d692c16bf94d7a0eec
7
+ data.tar.gz: b63929830119a1d174f42377e718d1d8bb04b0f9f0952d1b5ca1f3620addf66fc647bd9aa707c4226b428378bb9256b042fca6b7caea571733a3a0966b29dfe2
@@ -67,7 +67,10 @@ module Composable
67
67
  value = if instance_variable_defined?("@#{attribute}")
68
68
  instance_variable_get("@#{attribute}")
69
69
  else
70
- instance_variable_set("@#{attribute}", options[:default].deep_dup)
70
+ instance_variable_set(
71
+ "@#{attribute}",
72
+ options[:default].respond_to?(:call) ? options[:default].call : options[:default].deep_dup
73
+ )
71
74
  end
72
75
 
73
76
  options[:type] ? options[:type].cast(value) : value
@@ -3,10 +3,17 @@
3
3
  module Composable
4
4
  module Core
5
5
  module Command
6
+ extend ActiveSupport::Concern
7
+
6
8
  class NotImplementedError < ::StandardError; end
7
9
 
8
10
  attr_reader :result
9
11
 
12
+ prepended do
13
+ include ActiveModel::Validations
14
+ include ActiveSupport::Rescuable
15
+ end
16
+
10
17
  module ClassMethods
11
18
  def call(*args, **kwargs)
12
19
  new(*args, **kwargs).call
@@ -17,13 +24,6 @@ module Composable
17
24
  end
18
25
  end
19
26
 
20
- def self.prepended(base)
21
- base.extend ClassMethods
22
-
23
- base.include ActiveModel::Validations
24
- base.include ActiveSupport::Rescuable
25
- end
26
-
27
27
  def call(raise_exception: false)
28
28
  fail NotImplementedError unless defined?(super)
29
29
 
@@ -10,7 +10,7 @@ module Composable
10
10
  module VERSION
11
11
  MAJOR = 0
12
12
  MINOR = 0
13
- TINY = 10
13
+ TINY = 12
14
14
  PRE = nil
15
15
 
16
16
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: composable-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jairo Vazquez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-16 00:00:00.000000000 Z
11
+ date: 2024-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.3.7
82
+ rubygems_version: 3.5.5
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Core Composable Object