Module: UseCases::ModuleOptins
- Included in:
- UseCase
- Defined in:
- lib/use_cases/module_optins.rb,
lib/use_cases/module_optins/locked.rb,
lib/use_cases/module_optins/prepared.rb,
lib/use_cases/module_optins/validated.rb,
lib/use_cases/module_optins/authorized.rb,
lib/use_cases/module_optins/transactional.rb
Defined Under Namespace
Modules: Authorized, Locked, Prepared, Transactional, Validated
Constant Summary collapse
- OPTINS =
{ authorized: Authorized, transactional: Transactional, validated: Validated, prepared: Prepared, locked: Locked }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
11 12 13 |
# File 'lib/use_cases/module_optins.rb', line 11 def @options end |
Instance Method Details
#[](*options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/use_cases/module_optins.rb', line 21 def [](*) modules = [self] OPTINS.each do |key, module_constant| modules << module_constant if .include?(key) end supermodule = Module.new supermodule.define_singleton_method(:included) do |base| base.include(*modules) end supermodule end |
#descendants ⇒ Object
37 38 39 |
# File 'lib/use_cases/module_optins.rb', line 37 def descendants ObjectSpace.each_object(Class).select { |klass| klass < self } end |