Class: ParamsReady::AbstractReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/params_ready/result.rb

Direct Known Subclasses

Reporter, Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ AbstractReporter

Returns a new instance of AbstractReporter.



7
8
9
# File 'lib/params_ready/result.rb', line 7

def initialize(name)
  @name = name.to_s.freeze
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/params_ready/result.rb', line 5

def name
  @name
end

Instance Method Details

#error!(err) ⇒ Object



11
12
13
# File 'lib/params_ready/result.rb', line 11

def error!(err)
  report_error(nil, err)
end

#for_child(name) ⇒ Object



20
21
22
# File 'lib/params_ready/result.rb', line 20

def for_child(name)
  Reporter.new name, self
end

#full_path(path) ⇒ Object



15
16
17
18
# File 'lib/params_ready/result.rb', line 15

def full_path(path)
  return [name] if path.nil? || path.empty?
  [name, *path]
end