Class: Decouplio::DefaultMetaStore

Inherits:
Object
  • Object
show all
Defined in:
lib/decouplio/default_meta_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDefaultMetaStore

Returns a new instance of DefaultMetaStore.



8
9
10
11
# File 'lib/decouplio/default_meta_store.rb', line 8

def initialize
  @errors = {}
  @status = nil
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/decouplio/default_meta_store.rb', line 6

def errors
  @errors
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/decouplio/default_meta_store.rb', line 5

def status
  @status
end

Instance Method Details

#add_error(key, messages) ⇒ Object



13
14
15
16
17
18
# File 'lib/decouplio/default_meta_store.rb', line 13

def add_error(key, messages)
  @errors.store(
    key,
    (@errors[key] || []) + [messages].flatten
  )
end

#to_sObject



20
21
22
23
24
25
26
27
# File 'lib/decouplio/default_meta_store.rb', line 20

def to_s
  <<~METASTORE
    Status: #{@status || 'NONE'}

    Errors:
      #{errors_string}
  METASTORE
end