Module: Pavlov::Operation
- Extended by:
- Concern
- Includes:
- Helpers, Validations
- Included in:
- Command, Interactor, Query
- Defined in:
- lib/pavlov/operation.rb,
lib/pavlov/alpha_compatibility.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Methods included from Concern
append_features, extended, included
Methods included from Validations
#validate_hexadecimal_string, #validate_in_set, #validate_integer, #validate_integer_string, #validate_nonempty_string, #validate_not_nil, #validate_regex, #validate_string
Methods included from Helpers
#command, #interactor, #pavlov_options, #query
Instance Method Details
#call(*args, &block) ⇒ Object
37 38 39 40 41 |
# File 'lib/pavlov/operation.rb', line 37 def call(*args, &block) raise Pavlov::ValidationError, 'Some validations fail, cannot execute' unless valid? execute(*args, &block) end |
#errors ⇒ Object
26 27 28 |
# File 'lib/pavlov/operation.rb', line 26 def errors @errors ||= ActiveModel::Errors.new(self) end |
#valid? ⇒ Boolean
30 31 32 33 34 35 |
# File 'lib/pavlov/operation.rb', line 30 def valid? check_validation errors.empty? rescue Pavlov::ValidationError false end |