Class: Vedeu::Coercers::HorizontalAlignment Private

Inherits:
Alignment
  • Object
show all
Defined in:
lib/vedeu/coercers/horizontal_alignment.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 validate a horizontal alignment value.

Instance Attribute Summary

Attributes inherited from Alignment

#value

Instance Method Summary collapse

Methods inherited from Alignment

#bottom_aligned?, #centre_aligned?, coerce, #coerce, #eql?, #horizontal_values, #initialize, #invalid?, #left_aligned?, #middle_aligned?, #right_aligned?, #top_aligned?, #unaligned?, #valid?, #valid_horizontal?, #valid_type?, #valid_vertical?, validate, #values, #vertical_values

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::Alignment

Instance Method Details

#to_sentenceString (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.

Returns:

  • (String)


26
27
28
# File 'lib/vedeu/coercers/horizontal_alignment.rb', line 26

def to_sentence
  Vedeu::Sentence.construct(horizontal_values)
end

#validateBoolean

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:

Raises:

  • (Vedeu::Error::InvalidSyntax)

    When the value given for an argument or parameter cannot be used because it is not valid for the use case, unsupported or the method expects a different type.



15
16
17
18
19
20
21
# File 'lib/vedeu/coercers/horizontal_alignment.rb', line 15

def validate
  return coerce if valid_horizontal?

  raise Vedeu::Error::InvalidSyntax,
        'Missing or invalid horizontal alignment value. ' \
        "Valid values are: #{to_sentence}"
end