Class: Vedeu::Coercers::Page Private
- Defined in:
- lib/vedeu/coercers/page.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 a Models::Page.
Instance Attribute Summary
Attributes inherited from Coercer
Instance Method Summary collapse
- #coerce ⇒ Vedeu::Models::Page private
- #klass ⇒ Class private private
Methods inherited from Coercer
#child_klass, coerce, #coerced?, #incoercible!, #initialize
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
This class inherits a constructor from Vedeu::Coercers::Coercer
Instance Method Details
#coerce ⇒ Vedeu::Models::Page
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.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vedeu/coercers/page.rb', line 16 def coerce if coerced? value elsif value.is_a?(Vedeu::Models::Row) klass.new([value]) elsif array?(value) && value.empty? klass.new([Vedeu::Models::Row.coerce(value)]) elsif array?(value) || value.is_a?(Vedeu::Buffers::View) values = value.map { |v| Vedeu::Models::Row.coerce(v) } klass.new(values) else incoercible! end end |