Class: Vedeu::Coercers::Coercer Private
- Inherits:
-
Object
- Object
- Vedeu::Coercers::Coercer
- Includes:
- Vedeu::Common
- Defined in:
- lib/vedeu/coercers/coercer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the mechanism to convert a value into another value.
Direct Known Subclasses
Chars, Colour, EditorLine, EditorLines, Lines, Page, Position, Row, Streams, Style
Instance Attribute Summary collapse
- #value ⇒ void readonly protected private
Class Method Summary collapse
- .coerce(value) ⇒ Object private
Instance Method Summary collapse
- #coerce ⇒ Object private
- #coerced? ⇒ Boolean private private
- #incoercible! ⇒ Object private private
-
#initialize(value) ⇒ Vedeu::Coercers::Coercer
constructor
private
Returns a new instance of the Vedeu::Coercers::Coercer subclass.
- #klass ⇒ Object private private
Methods included from Vedeu::Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Constructor Details
#initialize(value) ⇒ Vedeu::Coercers::Coercer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of the Vedeu::Coercers::Coercer subclass.
26 27 28 |
# File 'lib/vedeu/coercers/coercer.rb', line 26 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ void (readonly, protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
39 40 41 |
# File 'lib/vedeu/coercers/coercer.rb', line 39 def value @value end |
Class Method Details
.coerce(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/vedeu/coercers/coercer.rb', line 17 def self.coerce(value) new(value).coerce end |
Instance Method Details
#coerce ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/vedeu/coercers/coercer.rb', line 31 def coerce raise Vedeu::Error::NotImplemented, 'Subclasses implement this.' end |
#coerced? ⇒ Boolean (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 |
# File 'lib/vedeu/coercers/coercer.rb', line 44 def coerced? value.is_a?(klass) end |
#incoercible! ⇒ Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 52 |
# File 'lib/vedeu/coercers/coercer.rb', line 49 def incoercible! raise Vedeu::Error::Fatal, "Vedeu cannot coerce a '#{value.class.name}' into a '#{klass}'." end |
#klass ⇒ Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
55 56 57 |
# File 'lib/vedeu/coercers/coercer.rb', line 55 def klass raise Vedeu::Error::NotImplemented, 'Subclasses implement this.' end |