Module: ActiveCommand::Base::ClassMethods
- Defined in:
- lib/active_command/base.rb
Instance Method Summary collapse
- #after(&block) ⇒ Object
- #base_class_after_hooks ⇒ Object
- #base_class_before_hooks ⇒ Object
- #base_class_parameters ⇒ Object
- #before(&block) ⇒ Object
- #call(options = {}) ⇒ Object
- #optional(name, options = {}) ⇒ Object
- #required(name, options = {}) ⇒ Object
Instance Method Details
#after(&block) ⇒ Object
35 36 37 |
# File 'lib/active_command/base.rb', line 35 def after(&block) base_class_after_hooks << block end |
#base_class_after_hooks ⇒ Object
47 48 49 |
# File 'lib/active_command/base.rb', line 47 def base_class_after_hooks class_variable_get(:@@after_hooks) end |
#base_class_before_hooks ⇒ Object
43 44 45 |
# File 'lib/active_command/base.rb', line 43 def base_class_before_hooks class_variable_get(:@@before_hooks) end |
#base_class_parameters ⇒ Object
39 40 41 |
# File 'lib/active_command/base.rb', line 39 def base_class_parameters class_variable_get(:@@parameter_definitions) end |
#before(&block) ⇒ Object
31 32 33 |
# File 'lib/active_command/base.rb', line 31 def before(&block) base_class_before_hooks << block end |
#call(options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/active_command/base.rb', line 11 def call( = {}) instance = new() instance.run instance end |
#optional(name, options = {}) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/active_command/base.rb', line 24 def optional(name, = {}) base_class_parameters[name] = { type: [:type], required: false } end |
#required(name, options = {}) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/active_command/base.rb', line 17 def required(name, = {}) base_class_parameters[name] = { type: [:type], required: true } end |