Exception: HCast::Errors::AttributeError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(message, namespace = nil) ⇒ AttributeError
15
16
17
18
19
|
# File 'lib/hcast/errors.rb', line 15
def initialize(message, namespace = nil)
super(message)
@namespaces = []
@namespaces << namespace if namespace
end
|
Instance Attribute Details
#namespaces ⇒ Object
Returns the value of attribute namespaces.
13
14
15
|
# File 'lib/hcast/errors.rb', line 13
def namespaces
@namespaces
end
|
Instance Method Details
#add_namespace(namespace) ⇒ Object
21
22
23
|
# File 'lib/hcast/errors.rb', line 21
def add_namespace(namespace)
namespaces << namespace
end
|
#message ⇒ Object
25
26
27
|
# File 'lib/hcast/errors.rb', line 25
def message
to_s
end
|
#to_s ⇒ Object
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/hcast/errors.rb', line 29
def to_s
if namespaces.empty?
super
else
reverted_namespaces = namespaces.reverse
msg = reverted_namespaces.first.to_s
msg += reverted_namespaces[1..-1].inject("") { |res, item| res += "[#{item}]"}
msg + " " + super
end
end
|