Class: Vedeu::Geometry::Alignment Private
- Inherits:
-
Object
- Object
- Vedeu::Geometry::Alignment
- Defined in:
- lib/vedeu/geometry/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.
The subclasses of this class, HorizontalAlignment and VerticalAlignment provide the mechanism to align an interface or view horizontally or vertically within the available terminal space.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #align ⇒ Object private
-
#bottom_aligned? ⇒ Boolean
private
Return a boolean indicating alignment was set to :bottom.
-
#centre_aligned? ⇒ Boolean
private
Return a boolean indicating alignment was set to :centre.
-
#initialize(value = nil) ⇒ Vedeu::Geometry::Alignment
constructor
private
Returns a new instance of Vedeu::Geometry::Alignment.
-
#left_aligned? ⇒ Boolean
private
Return a boolean indicating alignment was set to :left.
-
#middle_aligned? ⇒ Boolean
private
Return a boolean indicating alignment was set to :middle.
- #none? ⇒ Boolean private private
-
#right_aligned? ⇒ Boolean
private
Return a boolean indicating alignment was set to :right.
-
#top_aligned? ⇒ Boolean
private
Return a boolean indicating alignment was set to :top.
-
#unaligned? ⇒ Boolean
private
Return a boolean indicating alignment was set to, or is :none.
- #valid? ⇒ Boolean private private
- #value ⇒ Symbol private private
- #values ⇒ Array<Symbol> private private
Constructor Details
#initialize(value = nil) ⇒ Vedeu::Geometry::Alignment
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 Vedeu::Geometry::Alignment.
42 43 44 |
# File 'lib/vedeu/geometry/alignment.rb', line 42 def initialize(value = nil) @value = value end |
Class Method Details
.align(value = nil) ⇒ 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.
19 20 21 |
# File 'lib/vedeu/geometry/alignment.rb', line 19 def self.align(value = nil) new(value).align end |
.coerce(value = nil) ⇒ Vedeu::Geometry::Alignment
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.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vedeu/geometry/alignment.rb', line 25 def self.coerce(value = nil) if value.is_a?(self) value elsif value.is_a?(Symbol) new(value) else new(:none) end end |
Instance Method Details
#align ⇒ 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.
48 49 50 |
# File 'lib/vedeu/geometry/alignment.rb', line 48 def align fail Vedeu::Error::NotImplemented, 'Subclasses implement this.'.freeze end |
#bottom_aligned? ⇒ Boolean
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.
Return a boolean indicating alignment was set to :bottom.
55 56 57 |
# File 'lib/vedeu/geometry/alignment.rb', line 55 def bottom_aligned? value == :bottom end |
#centre_aligned? ⇒ Boolean
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.
Return a boolean indicating alignment was set to :centre.
62 63 64 |
# File 'lib/vedeu/geometry/alignment.rb', line 62 def centre_aligned? value == :centre end |
#left_aligned? ⇒ Boolean
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.
Return a boolean indicating alignment was set to :left.
69 70 71 |
# File 'lib/vedeu/geometry/alignment.rb', line 69 def left_aligned? value == :left end |
#middle_aligned? ⇒ Boolean
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.
Return a boolean indicating alignment was set to :middle.
76 77 78 |
# File 'lib/vedeu/geometry/alignment.rb', line 76 def middle_aligned? value == :middle end |
#none? ⇒ 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.
104 105 106 |
# File 'lib/vedeu/geometry/alignment.rb', line 104 def none? @value == :none || @value.nil? || !(@value.is_a?(Symbol)) end |
#right_aligned? ⇒ Boolean
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.
Return a boolean indicating alignment was set to :right.
83 84 85 |
# File 'lib/vedeu/geometry/alignment.rb', line 83 def right_aligned? value == :right end |
#top_aligned? ⇒ Boolean
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.
Return a boolean indicating alignment was set to :top.
90 91 92 |
# File 'lib/vedeu/geometry/alignment.rb', line 90 def top_aligned? value == :top end |
#unaligned? ⇒ Boolean
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.
Return a boolean indicating alignment was set to, or is :none.
97 98 99 |
# File 'lib/vedeu/geometry/alignment.rb', line 97 def unaligned? value == :none end |
#valid? ⇒ 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.
109 110 111 |
# File 'lib/vedeu/geometry/alignment.rb', line 109 def valid? values.include?(value) end |
#value ⇒ Symbol (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.
114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/vedeu/geometry/alignment.rb', line 114 def value @_value ||= if none? :none elsif @value == :center :centre else @value.to_sym end end |
#values ⇒ Array<Symbol> (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.
128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/vedeu/geometry/alignment.rb', line 128 def values [ :bottom, :centre, :left, :middle, :none, :right, :top, ] end |