Exception: SparkleFormation::Error::NotFound
- Inherits:
-
KeyError
- Object
- KeyError
- SparkleFormation::Error::NotFound
- Defined in:
- lib/sparkle_formation/error.rb
Overview
File not found error
Defined Under Namespace
Classes: Component, Dynamic, Registry, Resource, Template
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(*args) ⇒ NotFound
constructor
A new instance of NotFound.
-
#to_s ⇒ String
Customized message including name.
Constructor Details
#initialize(*args) ⇒ NotFound
Returns a new instance of NotFound
18 19 20 21 22 23 |
# File 'lib/sparkle_formation/error.rb', line 18 def initialize(*args) opts = args.detect { |o| o.is_a?(Hash) } args.delete(opts) if opts super(args) @name = opts[:name] if opts end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name
16 17 18 |
# File 'lib/sparkle_formation/error.rb', line 16 def name @name end |
Instance Method Details
#to_s ⇒ String
Returns customized message including name
26 27 28 29 30 31 32 |
# File 'lib/sparkle_formation/error.rb', line 26 def to_s if name "Failed to locate item named: `#{name}`" else "Failed to locate item" end end |