Class: Vedeu::Geometries::Geometry Private
- Inherits:
-
Object
- Object
- Vedeu::Geometries::Geometry
- Extended by:
- Forwardable
- Includes:
- Repositories::Model
- Defined in:
- lib/vedeu/geometries/geometry.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.
Consider storing the Terminal size at the time of first
creation, this allows us to return the interface to its original dimensions if the terminal resizes back to normal size.
Calculates and provides interface geometry determined by both the client’s requirements and the terminal’s current viewing area.
Instance Attribute Summary collapse
- #client ⇒ Object
- #height ⇒ Fixnum writeonly private
- #horizontal_alignment ⇒ Symbol
- #maximised ⇒ Boolean (also: #maximised?)
-
#name ⇒ NilClass|Symbol|String
The name of the model, the target model or the name of the associated model.
- #vertical_alignment ⇒ Symbol
- #width ⇒ Fixnum writeonly private
- #x ⇒ Fixnum writeonly private
- #xn ⇒ Fixnum writeonly private
- #y ⇒ Fixnum writeonly private
- #yn ⇒ Fixnum writeonly private
Instance Method Summary collapse
- #area ⇒ Vedeu::Geometries::Area private private
- #attributes ⇒ Hash<Symbol => Boolean|Fixnum|String|Symbol> private
-
#defaults ⇒ Hash<Symbol => void>
private
private
The default options/attributes for a new instance of this class.
-
#deputy(client = nil) ⇒ Vedeu::Geometries::DSL
private
Returns a DSL instance responsible for defining the DSL methods of this model.
-
#eql?(other) ⇒ Boolean
(also: #==)
private
An object is equal when its values are the same.
-
#initialize(attributes = {}) ⇒ Vedeu::Geometries::Geometry
constructor
private
Returns a new instance of Vedeu::Geometries::Geometry.
-
#maximise ⇒ Vedeu::Geometries::Geometry|NilClass
private
- #repository ⇒ Vedeu::Geometries::Repository private
-
#unmaximise ⇒ Vedeu::Geometries::Geometry|NilClass
private
Methods included from Repositories::Model
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Geometries::Geometry
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::Geometries::Geometry.
106 107 108 109 110 |
# File 'lib/vedeu/geometries/geometry.rb', line 106 def initialize(attributes = {}) defaults.merge!(attributes).each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#client ⇒ Object
46 47 48 |
# File 'lib/vedeu/geometries/geometry.rb', line 46 def client @client end |
#height=(value) ⇒ Fixnum (writeonly)
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/geometries/geometry.rb', line 50 def height=(value) @height = value end |
#horizontal_alignment ⇒ Symbol
54 55 56 |
# File 'lib/vedeu/geometries/geometry.rb', line 54 def horizontal_alignment @horizontal_alignment end |
#maximised ⇒ Boolean Also known as: maximised?
58 59 60 |
# File 'lib/vedeu/geometries/geometry.rb', line 58 def maximised @maximised end |
#name ⇒ NilClass|Symbol|String
Returns The name of the model, the target model or the name of the associated model.
63 64 65 |
# File 'lib/vedeu/geometries/geometry.rb', line 63 def name @name end |
#vertical_alignment ⇒ Symbol
67 68 69 |
# File 'lib/vedeu/geometries/geometry.rb', line 67 def vertical_alignment @vertical_alignment end |
#width=(value) ⇒ Fixnum (writeonly)
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.
71 72 73 |
# File 'lib/vedeu/geometries/geometry.rb', line 71 def width=(value) @width = value end |
#x=(value) ⇒ Fixnum (writeonly)
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.
75 76 77 |
# File 'lib/vedeu/geometries/geometry.rb', line 75 def x=(value) @x = value end |
#xn=(value) ⇒ Fixnum (writeonly)
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.
79 80 81 |
# File 'lib/vedeu/geometries/geometry.rb', line 79 def xn=(value) @xn = value end |
#y=(value) ⇒ Fixnum (writeonly)
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.
83 84 85 |
# File 'lib/vedeu/geometries/geometry.rb', line 83 def y=(value) @y = value end |
#yn=(value) ⇒ Fixnum (writeonly)
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.
87 88 89 |
# File 'lib/vedeu/geometries/geometry.rb', line 87 def yn=(value) @yn = value end |
Instance Method Details
#area ⇒ Vedeu::Geometries::Area (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.
186 187 188 |
# File 'lib/vedeu/geometries/geometry.rb', line 186 def area @_area ||= Vedeu::Geometries::Area.from_attributes(attributes) end |
#attributes ⇒ Hash<Symbol => Boolean|Fixnum|String|Symbol>
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.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/vedeu/geometries/geometry.rb', line 113 def attributes { client: client, height: @height.is_a?(Proc) ? @height.call : @height, horizontal_alignment: horizontal_alignment, maximised: maximised, name: name, vertical_alignment: vertical_alignment, width: @width.is_a?(Proc) ? @width.call : @width, x: @x.is_a?(Proc) ? @x.call : @x, xn: @xn.is_a?(Proc) ? @xn.call : @xn, y: @y.is_a?(Proc) ? @y.call : @y, yn: @yn.is_a?(Proc) ? @yn.call : @yn, } end |
#defaults ⇒ Hash<Symbol => void> (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.
The default options/attributes for a new instance of this class.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/vedeu/geometries/geometry.rb', line 191 def defaults { client: nil, height: nil, horizontal_alignment: :none, maximised: false, name: nil, vertical_alignment: :none, width: nil, x: nil, xn: nil, y: nil, yn: nil, } end |
#deputy(client = nil) ⇒ Vedeu::Geometries::DSL
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 DSL instance responsible for defining the DSL methods of this model.
138 139 140 |
# File 'lib/vedeu/geometries/geometry.rb', line 138 def deputy(client = nil) Vedeu::Geometries::DSL.new(self, client) end |
#eql?(other) ⇒ Boolean Also known as: ==
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.
An object is equal when its values are the same.
146 147 148 |
# File 'lib/vedeu/geometries/geometry.rb', line 146 def eql?(other) self.class.equal?(other.class) && name == other.name end |
#maximise ⇒ Vedeu::Geometries::Geometry|NilClass
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.
153 154 155 156 157 158 159 160 161 162 |
# File 'lib/vedeu/geometries/geometry.rb', line 153 def maximise return self if maximised? @maximised = true @_area = nil store do Vedeu.trigger(:_refresh_view_, name) end end |
#repository ⇒ Vedeu::Geometries::Repository
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.
179 180 181 |
# File 'lib/vedeu/geometries/geometry.rb', line 179 def repository Vedeu.geometries end |
#unmaximise ⇒ Vedeu::Geometries::Geometry|NilClass
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.
166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/vedeu/geometries/geometry.rb', line 166 def unmaximise return self unless maximised? @maximised = false @_area = nil store do Vedeu.trigger(:_clear_) Vedeu.trigger(:_refresh_) end end |