Class: Core::Boundary::Result
- Inherits:
-
Object
- Object
- Core::Boundary::Result
- Includes:
- Is::Inspectable
- Defined in:
- lib/core/boundary/result.rb
Overview
- public
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
[public].
Instance Method Summary collapse
-
#[]=(key, value) ⇒ Object
[public].
-
#error?(*path) ⇒ Boolean
[public].
-
#errors(*path) ⇒ Object
[public].
- #finalize ⇒ Object
- #freeze ⇒ Object
-
#initialize ⇒ Result
constructor
A new instance of Result.
-
#success?(*path) ⇒ Boolean
[public].
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
15 16 17 18 |
# File 'lib/core/boundary/result.rb', line 15 def initialize @values = {} @errors = Errors.new end |
Instance Attribute Details
#values ⇒ Object (readonly)
- public
22 23 24 |
# File 'lib/core/boundary/result.rb', line 22 def values @values end |
Instance Method Details
#[]=(key, value) ⇒ Object
- public
48 49 50 |
# File 'lib/core/boundary/result.rb', line 48 def []=(key, value) @values[key.to_sym] = value end |
#error?(*path) ⇒ Boolean
- public
26 27 28 |
# File 'lib/core/boundary/result.rb', line 26 def error?(*path) @errors.any?(*path) end |
#errors(*path) ⇒ Object
- public
38 39 40 41 42 43 44 |
# File 'lib/core/boundary/result.rb', line 38 def errors(*path) if path.any? @errors.for(*path) else @errors end end |
#finalize ⇒ Object
52 53 54 55 |
# File 'lib/core/boundary/result.rb', line 52 def finalize freeze self end |
#freeze ⇒ Object
57 58 59 60 61 |
# File 'lib/core/boundary/result.rb', line 57 def freeze @arguments.freeze @values.freeze super end |
#success?(*path) ⇒ Boolean
- public
32 33 34 |
# File 'lib/core/boundary/result.rb', line 32 def success?(*path) @errors.empty?(*path) end |