muina 0.2.8 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +25 -0
  3. data/README.md +0 -35
  4. data/lib/muina/maybe/none.rb +61 -0
  5. data/lib/muina/maybe/some.rb +62 -0
  6. data/lib/muina/maybe.rb +13 -0
  7. data/lib/muina/result/failure.rb +7 -18
  8. data/lib/muina/result/success.rb +7 -18
  9. data/lib/muina/result.rb +6 -8
  10. data/lib/muina/version.rb +1 -2
  11. data/lib/muina.rb +0 -32
  12. metadata +24 -225
  13. data/.github/workflows/main.yml +0 -16
  14. data/.gitignore +0 -5
  15. data/.mutant.yml +0 -38
  16. data/.rspec +0 -4
  17. data/.rubocop.yml +0 -181
  18. data/.ruby-version +0 -1
  19. data/.simplecov +0 -14
  20. data/CHANGELOG.md +0 -38
  21. data/Gemfile +0 -34
  22. data/Gemfile.lock +0 -265
  23. data/Guardfile +0 -24
  24. data/Rakefile +0 -13
  25. data/SECURITY.md +0 -14
  26. data/bin/bundle +0 -114
  27. data/bin/console +0 -15
  28. data/bin/flay +0 -29
  29. data/bin/flog +0 -29
  30. data/bin/guard +0 -29
  31. data/bin/irb +0 -29
  32. data/bin/lefthook +0 -29
  33. data/bin/mutant +0 -29
  34. data/bin/parlour +0 -29
  35. data/bin/rake +0 -29
  36. data/bin/rspec +0 -29
  37. data/bin/rubocop +0 -29
  38. data/bin/setup +0 -8
  39. data/bin/srb +0 -29
  40. data/bin/srb-rbi +0 -29
  41. data/bin/tapioca +0 -29
  42. data/exe/muina +0 -11
  43. data/lefthook.yml +0 -39
  44. data/lib/muina/action/params_factory.rb +0 -17
  45. data/lib/muina/action/step/command.rb +0 -33
  46. data/lib/muina/action/step/failure.rb +0 -18
  47. data/lib/muina/action/step/query.rb +0 -35
  48. data/lib/muina/action/step/result.rb +0 -56
  49. data/lib/muina/action/step.rb +0 -13
  50. data/lib/muina/action.rb +0 -73
  51. data/lib/muina/any.rb +0 -7
  52. data/lib/muina/classes.rb +0 -7
  53. data/lib/muina/deprecator.rb +0 -93
  54. data/lib/muina/entity.rb +0 -20
  55. data/lib/muina/module.rb +0 -6
  56. data/lib/muina/parameters.rb +0 -7
  57. data/lib/muina/params.rb +0 -19
  58. data/lib/muina/private_creation.rb +0 -12
  59. data/lib/muina/result/factory.rb +0 -37
  60. data/lib/muina/result/null.rb +0 -25
  61. data/lib/muina/service.rb +0 -25
  62. data/lib/muina/symbol_hash.rb +0 -7
  63. data/lib/muina/unit.rb +0 -10
  64. data/lib/muina/untyped_array.rb +0 -7
  65. data/lib/muina/untyped_hash.rb +0 -7
  66. data/lib/muina/value.rb +0 -24
  67. data/muina.gemspec +0 -35
  68. data/rbi/muina.rbi +0 -311
  69. data/sorbet/config +0 -2
  70. data/sorbet/rbi/gems/actionpack@6.1.4.rbi +0 -5045
  71. data/sorbet/rbi/gems/actionview@6.1.4.rbi +0 -2416
  72. data/sorbet/rbi/gems/activesupport@6.1.4.rbi +0 -3778
  73. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -54
  74. data/sorbet/rbi/gems/awesome_print@1.9.2.rbi +0 -322
  75. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -8
  76. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -18
  77. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -8
  78. data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -39
  79. data/sorbet/rbi/gems/commander@4.6.0.rbi +0 -8
  80. data/sorbet/rbi/gems/concurrent-ruby@1.1.9.rbi +0 -2403
  81. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -123
  82. data/sorbet/rbi/gems/diff-lcs@1.4.4.rbi +0 -185
  83. data/sorbet/rbi/gems/docile@1.4.0.rbi +0 -54
  84. data/sorbet/rbi/gems/erubi@1.10.0.rbi +0 -36
  85. data/sorbet/rbi/gems/erubis@2.7.0.rbi +0 -8
  86. data/sorbet/rbi/gems/faker@2.18.0.rbi +0 -2469
  87. data/sorbet/rbi/gems/ffi@1.15.3.rbi +0 -8
  88. data/sorbet/rbi/gems/flay@2.12.1.rbi +0 -178
  89. data/sorbet/rbi/gems/flog@4.6.4.rbi +0 -70
  90. data/sorbet/rbi/gems/formatador@0.3.0.rbi +0 -8
  91. data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +0 -49
  92. data/sorbet/rbi/gems/guard-rspec@4.7.3.rbi +0 -233
  93. data/sorbet/rbi/gems/guard-rubocop@1.4.0.rbi +0 -66
  94. data/sorbet/rbi/gems/guard-shell@0.7.2.rbi +0 -69
  95. data/sorbet/rbi/gems/guard@2.18.0.rbi +0 -617
  96. data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
  97. data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -616
  98. data/sorbet/rbi/gems/io-console@0.5.9.rbi +0 -8
  99. data/sorbet/rbi/gems/irb@1.3.6.rbi +0 -452
  100. data/sorbet/rbi/gems/lefthook@0.7.6.rbi +0 -8
  101. data/sorbet/rbi/gems/listen@3.6.0.rbi +0 -476
  102. data/sorbet/rbi/gems/loofah@2.10.0.rbi +0 -223
  103. data/sorbet/rbi/gems/lumberjack@1.2.8.rbi +0 -431
  104. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -8
  105. data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -344
  106. data/sorbet/rbi/gems/mutant-license@0.1.1.1.4043027289354708743625974235631451632228.0.rbi +0 -8
  107. data/sorbet/rbi/gems/mutant-rspec@0.10.32.rbi +0 -8
  108. data/sorbet/rbi/gems/mutant@0.10.32.rbi +0 -4154
  109. data/sorbet/rbi/gems/nenv@0.3.0.rbi +0 -88
  110. data/sorbet/rbi/gems/nokogiri@1.11.7.rbi +0 -1422
  111. data/sorbet/rbi/gems/notiffany@0.1.3.rbi +0 -331
  112. data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -113
  113. data/sorbet/rbi/gems/parlour@6.0.1.rbi +0 -1726
  114. data/sorbet/rbi/gems/parser@3.0.2.0.rbi +0 -1683
  115. data/sorbet/rbi/gems/path_expander@1.1.0.rbi +0 -24
  116. data/sorbet/rbi/gems/polyfill@1.9.0.rbi +0 -393
  117. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -8
  118. data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -47
  119. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +0 -272
  120. data/sorbet/rbi/gems/rack@2.2.3.rbi +0 -1618
  121. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +0 -92
  122. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +0 -183
  123. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -153
  124. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -808
  125. data/sorbet/rbi/gems/rb-fsevent@0.11.0.rbi +0 -8
  126. data/sorbet/rbi/gems/rb-inotify@0.10.1.rbi +0 -8
  127. data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -1120
  128. data/sorbet/rbi/gems/reline@0.2.6.rbi +0 -662
  129. data/sorbet/rbi/gems/rexml@3.2.5.rbi +0 -672
  130. data/sorbet/rbi/gems/rspec-core@3.10.1.rbi +0 -2509
  131. data/sorbet/rbi/gems/rspec-expectations@3.10.1.rbi +0 -1574
  132. data/sorbet/rbi/gems/rspec-mocks@3.10.2.rbi +0 -1462
  133. data/sorbet/rbi/gems/rspec-support@3.10.2.rbi +0 -509
  134. data/sorbet/rbi/gems/rspec@3.10.0.rbi +0 -38
  135. data/sorbet/rbi/gems/rubocop-ast@1.8.0.rbi +0 -2194
  136. data/sorbet/rbi/gems/rubocop-performance@1.11.4.rbi +0 -899
  137. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +0 -118
  138. data/sorbet/rbi/gems/rubocop-rspec@2.4.0.rbi +0 -1805
  139. data/sorbet/rbi/gems/rubocop-sorbet@0.6.2.rbi +0 -288
  140. data/sorbet/rbi/gems/rubocop@1.18.4.rbi +0 -13197
  141. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -405
  142. data/sorbet/rbi/gems/ruby_parser@3.16.0.rbi +0 -4528
  143. data/sorbet/rbi/gems/safe_type@1.1.1.rbi +0 -157
  144. data/sorbet/rbi/gems/sexp_processor@4.15.3.rbi +0 -359
  145. data/sorbet/rbi/gems/shellany@0.0.1.rbi +0 -28
  146. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +0 -89
  147. data/sorbet/rbi/gems/simplecov@0.21.2.rbi +0 -577
  148. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.3.rbi +0 -8
  149. data/sorbet/rbi/gems/sorbet-coerce@0.5.0.rbi +0 -42
  150. data/sorbet/rbi/gems/sorbet-rails@0.7.4.rbi +0 -8
  151. data/sorbet/rbi/gems/sorbet-struct-comparable@1.1.0.rbi +0 -17
  152. data/sorbet/rbi/gems/spoom@1.1.1.rbi +0 -1193
  153. data/sorbet/rbi/gems/tapioca@0.4.23.rbi +0 -1826
  154. data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -838
  155. data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -856
  156. data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -26
  157. data/sorbet/rbi/gems/unparser@0.6.0.rbi +0 -2037
  158. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -173
  159. data/sorbet/rbi/todo.rbi +0 -8
  160. data/sorbet/rbi/typed_params.rbi +0 -7
  161. data/sorbet/tapioca/require.rb +0 -16
@@ -1,35 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- class Action
6
- class Step < Value
7
- # Queries are meant to run side effect free code and return the resulting value wrapped in a Result::Success
8
- class Query < self
9
- const :name, Symbol
10
-
11
- def call(action = Object.new) # rubocop:disable Metrics/MethodLength
12
- return if action.instance_variable_get(:@__failure__)
13
-
14
- case result = Muina::Result() { action.instance_eval(&step) }
15
- when Muina::Result::Success then success(action, result)
16
- when Muina::Result::Failure then failure(action, result)
17
- # :nocov:
18
- else T.absurd(result)
19
- # :nocov:
20
- end
21
- end
22
-
23
- private
24
-
25
- def success(action, result)
26
- action.instance_variable_set("@#{name}", result.value!)
27
- end
28
-
29
- def failure(action, result)
30
- action.instance_variable_set(:@__failure__, result)
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,56 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- class Action
6
- class Step < Value
7
- # Final step of a successful Action
8
- class Result < self
9
- # Eval the step and save the result
10
- class Caller
11
- # Save result on succesful side
12
- class Successful < self
13
- def initialize(action, result)
14
- super()
15
- @action = action
16
- @result = result
17
- end
18
-
19
- def call
20
- @action.instance_variable_set(:@__result__, @result)
21
- end
22
- end
23
-
24
- # Save result on failure side
25
- class Failed < self
26
- def initialize(action, result)
27
- super()
28
- @action = action
29
- @result = result
30
- end
31
-
32
- def call
33
- @action.instance_variable_set(:@__failure__, @result)
34
- end
35
- end
36
-
37
- def self.for(action, step)
38
- case result = Muina::Result() { action.instance_eval(&step) }
39
- when Muina::Result::Success then Caller::Successful.new(action, result)
40
- when Muina::Result::Failure then Caller::Failed.new(action, result)
41
- # :nocov:
42
- else T.absurd(result)
43
- # :nocov:
44
- end
45
- end
46
- end
47
-
48
- def call(action = Object.new)
49
- return if action.instance_variable_get(:@__failure__)
50
-
51
- Caller.for(action, step).call
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,13 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- class Action
6
- # Base class for diferent kind of action steps
7
- class Step < Value
8
- const :step, T.untyped
9
-
10
- def call(instance); end
11
- end
12
- end
13
- end
data/lib/muina/action.rb DELETED
@@ -1,73 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Two tracked result based operation
6
- class Action
7
- include T::Props
8
- include T::Props::Constructor
9
-
10
- class DoubleResultError < Error; end
11
-
12
- class DoubleFailureError < Error; end
13
-
14
- private_class_method :new
15
-
16
- def self.steps
17
- @steps ||= []
18
- end
19
-
20
- def self.extract(params)
21
- new(TypedParams[parameters].new.extract!(ParamsFactory.build(params)).serialize.symbolize_keys)
22
- end
23
- private_class_method :extract
24
-
25
- def self.result(&blk)
26
- raise DoubleResultError if @__result_set__
27
-
28
- steps << Step::Result.new(step: blk)
29
-
30
- @__result_set__ = true
31
- end
32
- private_class_method :result
33
-
34
- def self.failure(&blk)
35
- raise DoubleFailureError if @__failure_set__
36
-
37
- steps << Step::Failure.new(step: blk)
38
-
39
- @__failure_set__ = true
40
- end
41
- private_class_method :failure
42
-
43
- def self.command(_name = nil, &blk)
44
- steps << Step::Command.new(step: blk)
45
- end
46
- private_class_method :command
47
-
48
- def self.query(name, type = T.untyped, &blk)
49
- const name, type
50
- steps << Step::Query.new(name: name, step: blk)
51
- end
52
- private_class_method :query
53
-
54
- def self.parameters(&blk)
55
- @parameters ||= Class.new(T::Struct)
56
- parameters.instance_eval(&blk) if blk
57
- instance_eval(&blk) if blk
58
- @parameters
59
- end
60
-
61
- def self.call(hash = {})
62
- extract(hash).__send__(:perform)
63
- end
64
-
65
- private
66
-
67
- def perform
68
- self.class.steps.each { |step| step.call(self) }
69
-
70
- @__result__ || @__failure__ || Result::Null()
71
- end
72
- end
73
- end
data/lib/muina/any.rb DELETED
@@ -1,7 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- Any = T.type_alias { T.untyped }
6
- public_constant :Any
7
- end
data/lib/muina/classes.rb DELETED
@@ -1,7 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- Classes = T.type_alias { T.any(Class, T::Array[Class]) }
6
- public_constant :Classes
7
- end
@@ -1,93 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Method deprecator
6
- class Deprecator
7
- class Error < StandardError; end
8
-
9
- @instances = T.let(Hash.new { |h, k| h[k] = {} }, T::Hash[String, T.untyped])
10
-
11
- class << self
12
- sig { returns(T::Hash[String, T.untyped]) }
13
- attr_reader :instances
14
- end
15
-
16
- sig { returns(T::Hash[String, T.untyped]) }
17
- def self.renew_instances
18
- @instances = Hash.new { |h, k| h[k] = {} }
19
- end
20
-
21
- sig { params(name: String).void }
22
- def self.deactivate(name)
23
- instances[name][:raise] = false
24
- end
25
-
26
- sig { params(name: String).void }
27
- def self.activate(name)
28
- instances[name][:raise] = true
29
- end
30
-
31
- sig { params(name: String).returns(T.nilable(T::Boolean)) }
32
- def self.raise?(name)
33
- instances[name][:raise]
34
- end
35
-
36
- sig { params(old: String, new: T.nilable(String), logger: T.untyped, raise: T::Boolean).void }
37
- def self.call(old:, new: nil, logger: default_logger, raise: false)
38
- new(new: new, old: old, logger: logger, raise: raise).perform
39
- end
40
-
41
- sig { returns(Logger) }
42
- def self.default_logger
43
- Logger.new($stdout)
44
- end
45
-
46
- sig { params(old: T.untyped, logger: T.untyped, new: T.untyped, raise: T.untyped).void }
47
- def initialize(old:, logger:, new: nil, raise: false)
48
- @new = T.let(new, T.nilable(String))
49
- @old = T.let(old, String)
50
- @logger = T.let(logger, T.untyped)
51
- @raise = T.let(raise, T::Boolean)
52
- end
53
-
54
- sig { returns(T.nilable(String)) }
55
- attr_reader :new
56
-
57
- sig { returns(String) }
58
- attr_reader :old
59
-
60
- sig { returns(T.untyped) }
61
- attr_reader :logger
62
-
63
- sig { returns(T::Boolean) }
64
- attr_reader :raise
65
-
66
- sig { returns(T::Boolean) }
67
- def raise?() @raise end # rubocop:disable Style/SingleLineMethods
68
-
69
- sig { returns(NilClass) }
70
- def perform # rubocop:disable Metrics/MethodLength
71
- logger.warn message
72
- case conf = self.class.raise?(old)
73
- when nil then Kernel.raise Muina::Deprecator::Error, message if raise?
74
- when true then Kernel.raise Muina::Deprecator::Error, message
75
- when false then nil
76
- # :nocov:
77
- else T.absurd(conf)
78
- # :nocov:
79
- end
80
- end
81
-
82
- private
83
-
84
- sig { returns(String) }
85
- def message
86
- if new
87
- "Method: #{old} has been DEPRECATED, please use #{new} instead"
88
- else
89
- "Method: #{old} has been DEPRECATED with no replacement"
90
- end
91
- end
92
- end
93
- end
data/lib/muina/entity.rb DELETED
@@ -1,20 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Immutable Value Object parent class
6
- class Entity
7
- include T::Props
8
- include T::Props::Constructor
9
-
10
- const :id, Integer
11
-
12
- def serialize
13
- self.class.props.keys.to_h { |prop| [prop, __send__(prop)] }
14
- end
15
-
16
- def with(hash = {})
17
- self.class.new(serialize.merge(hash))
18
- end
19
- end
20
- end
data/lib/muina/module.rb DELETED
@@ -1,6 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- class Module
5
- include T::Sig
6
- end
@@ -1,7 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- Parameters = T.type_alias { T.any(UntypedHash, ActionController::Parameters) }
6
- public_constant :Parameters
7
- end
data/lib/muina/params.rb DELETED
@@ -1,19 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Typesafe parameters with extraction from ActionController::Parameters
6
- class Params
7
- include T::Props
8
- include T::Props::Constructor
9
-
10
- def self.extract(params)
11
- params = ActionController::Parameters.new(params) if params.instance_of?(Hash)
12
- TypedParams[self].new.extract!(params)
13
- end
14
-
15
- def self.<(other)
16
- super || T::Struct <= other
17
- end
18
- end
19
- end
@@ -1,12 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Include this module to make `.allocate` and `.new` private
6
- module PrivateCreation
7
- def self.included(klass)
8
- klass.private_class_method :allocate
9
- klass.private_class_method :new
10
- end
11
- end
12
- end
@@ -1,37 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Result Monad
6
- class Result < Value
7
- # Typed Results Factory.
8
- class Factory < T::Struct
9
- prop :success_klass, T.any(Classes, T::Types::Base)
10
- prop :error_klass, T.any(Classes, T::Types::Base)
11
-
12
- def success(value)
13
- success_subclass.__send__(:new, value: value)
14
- end
15
-
16
- def failure(error)
17
- failure_subclass.__send__(:new, error: error)
18
- end
19
-
20
- private
21
-
22
- def success_subclass
23
- klass_factory(Success, :value, success_klass)
24
- end
25
-
26
- def failure_subclass
27
- klass_factory(Failure, :error, error_klass)
28
- end
29
-
30
- def klass_factory(klass, symbol, sklass)
31
- iklass = T.unsafe(Class.new(klass)) # rubocop:disable Sorbet/ForbidTUnsafe
32
- iklass.const symbol, sklass, override: true
33
- iklass.__send__(:private, symbol)
34
- end
35
- end
36
- end
37
- end
@@ -1,25 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- class Result < Value
6
- # Private null type for the Result Monad
7
- class Null < self
8
- def value!
9
- raise Error
10
- end
11
-
12
- def error!
13
- raise Error
14
- end
15
-
16
- def and_then(&_blk)
17
- self
18
- end
19
-
20
- def or_else(&_blk)
21
- self
22
- end
23
- end
24
- end
25
- end
data/lib/muina/service.rb DELETED
@@ -1,25 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Simple Service Object compatible with MiniService::Base
6
- class Service
7
- include T::Props
8
- include T::Props::Constructor
9
- include PrivateCreation
10
-
11
- def self.call(hash = {})
12
- new(hash).__send__(:perform)
13
- end
14
- class << self; alias_method :[], :call; end
15
-
16
- def self.arguments(*args, **opts)
17
- args.each { |arg| const arg, T.untyped }
18
- opts.each { |key, value| const key, T.untyped, default: value }
19
- end
20
-
21
- def perform
22
- raise NotImplementedError, "Please implement the #{self.class}#perform method"
23
- end
24
- end
25
- end
@@ -1,7 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- SymbolHash = T.type_alias { T::Hash[Symbol, T.untyped] }
6
- public_constant :SymbolHash
7
- end
data/lib/muina/unit.rb DELETED
@@ -1,10 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- class Unit
6
- include Singleton
7
- end
8
- UNIT = T.let(Unit.instance, Unit)
9
- public_constant :UNIT
10
- end
@@ -1,7 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- UntypedArray = T.type_alias { T::Array[T.untyped] }
6
- public_constant :UntypedArray
7
- end
@@ -1,7 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- UntypedHash = T.type_alias { T::Hash[T.untyped, T.untyped] }
6
- public_constant :UntypedHash
7
- end
data/lib/muina/value.rb DELETED
@@ -1,24 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Muina
5
- # Immutable Value Object parent class
6
- class Value
7
- include T::Props
8
- include T::Props::Constructor
9
- include T::Struct::ActsAsComparable
10
-
11
- def initialize(hash = {})
12
- super(hash)
13
- freeze
14
- end
15
-
16
- def serialize
17
- self.class.props.keys.to_h { |prop| [prop, __send__(prop)] }
18
- end
19
-
20
- def with(hash = {})
21
- self.class.new(serialize.merge(hash))
22
- end
23
- end
24
- end
data/muina.gemspec DELETED
@@ -1,35 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- require_relative 'lib/muina/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'muina'
8
- spec.version = Muina::VERSION
9
- spec.authors = ['vaporyhumo']
10
- spec.email = ['roanvilina@gmail.com']
11
-
12
- spec.summary = 'Rails and Sorbet compatible framework'
13
- spec.description = 'Useful parent classes for the Rails missing parts'
14
- spec.homepage = 'https://github.com/vaporyhumo/muina'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
16
-
17
- spec.metadata['homepage_uri'] = spec.homepage
18
- spec.metadata['source_code_uri'] = spec.homepage
19
- spec.metadata['changelog_uri'] = spec.homepage
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
- end
26
- spec.bindir = 'exe'
27
- spec.executables = ['muina']
28
- spec.require_paths = ['lib']
29
-
30
- spec.add_dependency 'actionpack'
31
- spec.add_dependency 'sorbet-rails'
32
- spec.add_dependency 'sorbet-runtime'
33
- spec.add_dependency 'sorbet-struct-comparable'
34
- spec.add_dependency 'zeitwerk'
35
- end