Class: Foobara::PossibleError
- Inherits:
-
Object
- Object
- Foobara::PossibleError
- Defined in:
- foobara-0.0.110/projects/common/src/possible_error.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#error_class ⇒ Object
Returns the value of attribute error_class.
-
#key ⇒ Object
Returns the value of attribute key.
-
#manually_added ⇒ Object
Returns the value of attribute manually_added.
-
#processor ⇒ Object
Returns the value of attribute processor.
Instance Method Summary collapse
- #dup ⇒ Object
-
#foobara_manifest ⇒ Object
TODO: technically does not belong in this project but maybe it should.
-
#initialize(error_class, key: nil, data: nil, symbol: error_class.symbol, category: error_class.category, processor: nil) ⇒ PossibleError
constructor
why can’t we set path here?.
- #prepend_path! ⇒ Object
- #prepend_runtime_path! ⇒ Object
Constructor Details
#initialize(error_class, key: nil, data: nil, symbol: error_class.symbol, category: error_class.category, processor: nil) ⇒ PossibleError
why can’t we set path here?
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 6 def initialize( error_class, key: nil, data: nil, symbol: error_class.symbol, category: error_class.category, processor: nil ) self.error_class = error_class self.processor = processor self.data = if data data elsif processor { processor.symbol => processor.declaration_data } end self.key = if key if key.is_a?(ErrorKey) key else ErrorKey.parse(key) end else ErrorKey.new(symbol:, category:) end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 3 def data @data end |
#error_class ⇒ Object
Returns the value of attribute error_class.
3 4 5 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 3 def error_class @error_class end |
#key ⇒ Object
Returns the value of attribute key.
3 4 5 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 3 def key @key end |
#manually_added ⇒ Object
Returns the value of attribute manually_added.
3 4 5 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 3 def manually_added @manually_added end |
#processor ⇒ Object
Returns the value of attribute processor.
3 4 5 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 3 def processor @processor end |
Instance Method Details
#dup ⇒ Object
32 33 34 35 36 37 38 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 32 def dup PossibleError.new( error_class, key: key.dup, data: ) end |
#foobara_manifest ⇒ Object
TODO: technically does not belong in this project but maybe it should
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 49 def to_include = TypeDeclarations. if to_include to_include << error_class end if processor processor_class = processor.class if to_include to_include << processor_class end if processor.scoped_path_set? # Unclear why nothing in the test suite passes through here. # TODO: either test this or delete it. # :nocov: to_include << processor processor_reference = processor. # :nocov: end end processor_manifest_data = data unless processor_reference Util.remove_blank( key.to_h.merge( key: key.to_s, error: error_class., processor: processor_reference, processor_class: processor_class&., processor_manifest_data:, manually_added: ) ) end |
#prepend_path! ⇒ Object
40 41 42 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 40 def prepend_path!(...) key.prepend_path!(...) end |
#prepend_runtime_path! ⇒ Object
44 45 46 |
# File 'foobara-0.0.110/projects/common/src/possible_error.rb', line 44 def prepend_runtime_path!(...) key.prepend_runtime_path!(...) end |