Class: ActiveInteractor::Context::Base
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ActiveInteractor::Context::Base
show all
- Extended by:
- Attributes::ClassMethods
- Includes:
- Attributes, Status, ActiveModel::Attributes, ActiveModel::Validations
- Defined in:
- lib/active_interactor/context/base.rb
Overview
Class Method Summary
collapse
-
.attribute(name, type = Type::Value.new, **options) ⇒ Object
-
.attribute_method?(attribute) ⇒ Object
-
.attribute_missing(match, *args, &block) ⇒ Object
-
.attribute_names ⇒ Object
-
.attributes(*attributes) ⇒ Array<Symbol>
extended
from Attributes::ClassMethods
Get or set attributes on a context class.
-
.clear_validators!(attribute) ⇒ Object
-
.method_missing(method, *args, &block) ⇒ Object
-
.respond_to?(method, include_private_methods = false) ⇒ Object
-
.respond_to_without_attributes?(method, include_private_methods = false) ⇒ Object
-
.validate(*args, &block) ⇒ Object
-
.validates(*attributes) ⇒ Object
-
.validates!(*attributes) ⇒ Object
-
.validates_absence_of(*attr_names) ⇒ Object
-
.validates_acceptance_of(*attr_names) ⇒ Object
-
.validates_confirmation_of(*attr_names) ⇒ Object
-
.validates_each(*attr_names, &block) ⇒ Object
-
.validates_exclusion_of(*attr_names) ⇒ Object
-
.validates_format_of(*attr_names) ⇒ Object
-
.validates_inclusion_of(*attr_names) ⇒ Object
-
.validates_length_of(*attr_names) ⇒ Object
-
.validates_numericality_of(*attr_names) ⇒ Object
-
.validates_presence_of(*attr_names) ⇒ Object
-
.validates_size_of(*attr_names) ⇒ Object
-
.validates_with(*args, &block) ⇒ Object
-
.validators ⇒ Object
-
.validators_on(*attributes) ⇒ Object
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
Class Method Details
.attribute(name, type = Type::Value.new, **options) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.attribute_method?(attribute) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.attribute_missing(match, *args, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.attribute_names ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.clear_validators!(attribute) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.method_missing(method, *args, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.respond_to?(method, include_private_methods = false) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.respond_to_without_attributes?(method, include_private_methods = false) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validate(*args, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates(*attributes) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates!(*attributes) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_absence_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_acceptance_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_confirmation_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_each(*attr_names, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_exclusion_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_inclusion_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_length_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_numericality_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_presence_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_size_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validates_with(*args, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validators ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
.validators_on(*attributes) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
Instance Method Details
#attribute?(attr_name) ⇒ Boolean
Also known as:
has_attribute?
Originally defined in module
Attributes
Check if the context instance has an attribute
#attribute_missing(match, *args, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#attribute_names ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#attributes ⇒ Hash{Symbol => *}
Originally defined in module
Attributes
#called!(interactor) ⇒ Array<Class>
Originally defined in module
Status
#errors ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#fail!(errors = nil) ⇒ Object
Originally defined in module
Status
Fail the context instance. Failing an instance raises an error that may be rescued by the calling
interactor. The instance is also flagged as having failed.
#failure? ⇒ Boolean
Also known as:
fail?
Originally defined in module
Status
Whether the context instance has failed. By default, a new instance is successful and only
changes when explicitly failed.
#initialize(context = {}) ⇒ Base
Originally defined in module
Attributes
Initialize a new instance of Base
#invalid?(context = nil) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#merge!(context) ⇒ self
Originally defined in module
Attributes
#respond_to?(method, include_private_methods = false) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#respond_to_without_attributes?(method, include_private_methods = false) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#rollback! ⇒ Boolean
Originally defined in module
Status
Rollback an instance of context. Any interactors the instance has
been passed via the #called! method are asked to roll themselves back by invoking their
#rollback methods. The instance is also flagged as rolled back.
#success? ⇒ Boolean
Also known as:
successful?
Originally defined in module
Status
Whether the context instance is successful. By default, a new instance is successful and only changes
when explicitly failed.
#valid?(context = nil) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validate(context = nil) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validate!(context = nil) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_absence_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_acceptance_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_confirmation_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_exclusion_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_inclusion_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_length_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_numericality_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_presence_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_size_of(*attr_names) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|
#validates_with(*args, &block) ⇒ Object
323
324
325
326
327
328
329
330
|
# File 'lib/active_interactor/context/base.rb', line 323
class Base < OpenStruct
extend ActiveInteractor::Context::Attributes::ClassMethods
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveInteractor::Context::Attributes
include ActiveInteractor::Context::Status
end
|