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
- #attributes ⇒ void readonly protected private
- #value ⇒ void readonly protected private
Class Method Summary collapse
Instance Method Summary collapse
- #child_klass ⇒ Object private private
- #coerce ⇒ Object private
- #coerced? ⇒ Boolean private private
- #incoercible! ⇒ Object private private
-
#initialize(value, attributes = {}) ⇒ 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, attributes = {}) ⇒ 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.
27 28 29 30 |
# File 'lib/vedeu/coercers/coercer.rb', line 27 def initialize(value, attributes = {}) @value = value @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ 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.
41 42 43 |
# File 'lib/vedeu/coercers/coercer.rb', line 41 def attributes @attributes end |
#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.
45 46 47 |
# File 'lib/vedeu/coercers/coercer.rb', line 45 def value @value end |
Class Method Details
.coerce(value, attributes = {}) ⇒ 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, attributes = {}) new(value, attributes).coerce end |
Instance Method Details
#child_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.
50 51 52 |
# File 'lib/vedeu/coercers/coercer.rb', line 50 def child_klass raise Vedeu::Error::NotImplemented end |
#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.
33 34 35 |
# File 'lib/vedeu/coercers/coercer.rb', line 33 def coerce raise Vedeu::Error::NotImplemented 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.
55 56 57 |
# File 'lib/vedeu/coercers/coercer.rb', line 55 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.
60 61 62 63 |
# File 'lib/vedeu/coercers/coercer.rb', line 60 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.
66 67 68 |
# File 'lib/vedeu/coercers/coercer.rb', line 66 def klass raise Vedeu::Error::NotImplemented end |