Exception: Fortitude::Widget::Files::CannotDetermineWidgetClassNameError
- Inherits:
-
StandardError
- Object
- StandardError
- Fortitude::Widget::Files::CannotDetermineWidgetClassNameError
- Defined in:
- lib/fortitude/widget/files.rb
Instance Attribute Summary collapse
-
#class_names_to_try ⇒ Object
readonly
Returns the value of attribute class_names_to_try.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#magic_comment_texts ⇒ Object
readonly
Returns the value of attribute magic_comment_texts.
-
#resulting_objects ⇒ Object
readonly
Returns the value of attribute resulting_objects.
-
#tried_class_names ⇒ Object
readonly
Returns the value of attribute tried_class_names.
Instance Method Summary collapse
-
#initialize(tried_class_names, options = { }) ⇒ CannotDetermineWidgetClassNameError
constructor
A new instance of CannotDetermineWidgetClassNameError.
Constructor Details
#initialize(tried_class_names, options = { }) ⇒ CannotDetermineWidgetClassNameError
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fortitude/widget/files.rb', line 12 def initialize(tried_class_names, = { }) .assert_valid_keys(:filename, :magic_comment_texts, :resulting_objects, :class_names_to_try) @tried_class_names = tried_class_names @filename = [:filename] @magic_comment_texts = [:magic_comment_texts] @resulting_objects = [:resulting_objects] @class_names_to_try = [:class_names_to_try] from_what = filename ? "from the file '#{filename}'" : "from some Fortitude source code" super %{You asked for a Fortitude class #{from_what}, but we couldn't determine the class name of the widget that supposedly is inside. We tried the following class names, in order: #{tried_class_names.join("\n")} ...but none of them both existed and were a class that eventually inherits from ::Fortitude::Widget. (We got back resulting objects: #{resulting_objects.inspect}) You can either pass the class name into this method via the :class_names_to_try option (we were passed #{class_names_to_try.inspect}), or add a "magic comment" to the source code of this widget that looks like this: #!<token>: <class_name> ...where <token> is one of: #{magic_comment_texts.join(", ")}} end |
Instance Attribute Details
#class_names_to_try ⇒ Object (readonly)
Returns the value of attribute class_names_to_try.
10 11 12 |
# File 'lib/fortitude/widget/files.rb', line 10 def class_names_to_try @class_names_to_try end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
10 11 12 |
# File 'lib/fortitude/widget/files.rb', line 10 def filename @filename end |
#magic_comment_texts ⇒ Object (readonly)
Returns the value of attribute magic_comment_texts.
10 11 12 |
# File 'lib/fortitude/widget/files.rb', line 10 def magic_comment_texts @magic_comment_texts end |
#resulting_objects ⇒ Object (readonly)
Returns the value of attribute resulting_objects.
10 11 12 |
# File 'lib/fortitude/widget/files.rb', line 10 def resulting_objects @resulting_objects end |
#tried_class_names ⇒ Object (readonly)
Returns the value of attribute tried_class_names.
10 11 12 |
# File 'lib/fortitude/widget/files.rb', line 10 def tried_class_names @tried_class_names end |