Class: RestMyCase::Context::Base
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- RestMyCase::Context::Base
- Includes:
- ActiveModel::Serialization
- Defined in:
- lib/rest_my_case/context/base.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #errors ⇒ Object
- #to_hash ⇒ Object
- #valid? ⇒ Boolean (also: #ok?)
Class Method Details
.error_class ⇒ Object
10 11 12 |
# File 'lib/rest_my_case/context/base.rb', line 10 def self.error_class Errors::Base end |
Instance Method Details
#errors ⇒ Object
18 19 20 |
# File 'lib/rest_my_case/context/base.rb', line 18 def errors @errors ||= self.class.error_class.new(self) end |
#to_hash ⇒ Object
14 15 16 |
# File 'lib/rest_my_case/context/base.rb', line 14 def to_hash Marshal.load Marshal.dump(attributes) end |
#valid? ⇒ Boolean Also known as: ok?
22 23 24 |
# File 'lib/rest_my_case/context/base.rb', line 22 def valid? errors.empty? end |