Class: Camille::TypeError
- Inherits:
-
Object
- Object
- Camille::TypeError
- Defined in:
- lib/camille/type_error.rb
Defined Under Namespace
Classes: ArgumentError
Instance Attribute Summary collapse
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #basic? ⇒ Boolean
- #checked? ⇒ Boolean
-
#initialize(message = nil, **components) ⇒ TypeError
constructor
A new instance of TypeError.
- #inspect ⇒ Object
- #to_s ⇒ Object
- #type_error? ⇒ Boolean
Constructor Details
#initialize(message = nil, **components) ⇒ TypeError
Returns a new instance of TypeError.
7 8 9 10 11 12 13 14 15 |
# File 'lib/camille/type_error.rb', line 7 def initialize = nil, **components if .is_a? String @message = elsif !components.empty? @components = components else raise ArgumentError.new("Expecting one string or one hash.") end end |
Instance Attribute Details
#components ⇒ Object (readonly)
Returns the value of attribute components.
5 6 7 |
# File 'lib/camille/type_error.rb', line 5 def components @components end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/camille/type_error.rb', line 5 def @message end |
Instance Method Details
#basic? ⇒ Boolean
17 18 19 |
# File 'lib/camille/type_error.rb', line 17 def basic? !!@message end |
#checked? ⇒ Boolean
31 32 33 |
# File 'lib/camille/type_error.rb', line 31 def checked? false end |
#inspect ⇒ Object
21 22 23 24 25 |
# File 'lib/camille/type_error.rb', line 21 def inspect string_io = StringIO.new Camille::TypeErrorPrinter.new(self).print string_io "#<Camille::TypeError\n#{string_io.string}>" end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/camille/type_error.rb', line 27 def to_s inspect end |
#type_error? ⇒ Boolean
35 36 37 |
# File 'lib/camille/type_error.rb', line 35 def type_error? true end |