Class: Vedeu::Interface
- Inherits:
-
Object
- Object
- Vedeu::Interface
- Extended by:
- Forwardable
- Includes:
- DisplayBuffer, Model, Presentation
- Defined in:
- lib/vedeu/models/view/interface.rb
Overview
Instance Attribute Summary collapse
-
#colour ⇒ Object
Returns the value of attribute colour.
-
#delay ⇒ Object
Returns the value of attribute delay.
-
#group ⇒ Object
Returns the value of attribute group.
- #lines ⇒ Vedeu::Lines (also: #content, #value)
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#style ⇒ Object
Returns the value of attribute style.
Attributes included from Model
Instance Method Summary collapse
- #add(child) ⇒ void
- #attributes ⇒ Hash
-
#border ⇒ Vedeu::Border|NilClass
Returns the border object belonging to the interface.
-
#border? ⇒ Boolean
Returns a boolean indicating whether the interface has a border.
-
#cursor ⇒ Vedeu::Cursor
Fetch the cursor belonging to this interface (by name), if one does not exist, it will be created, stored and returned.
-
#defaults ⇒ Hash
private
The default values for a new instance of this class.
- #geometry ⇒ Vedeu::Geometry
-
#initialize(attributes = {}) ⇒ Vedeu::Interface
constructor
Return a new instance of Interface.
-
#lines? ⇒ Boolean
Returns a boolean indicating whether the interface has content.
- #store ⇒ Interface
Methods included from DisplayBuffer
#store_cursor, #store_deferred, #store_focusable, #store_group, #store_immediate, #store_new_buffer
Methods included from Common
Methods included from Presentation
#background, #foreground, #parent_background, #parent_colour, #parent_foreground, #parent_style, #render_border, #render_colour, #render_position, #render_style, #to_s
Methods included from Model
#demodulize, #deputy, #dsl_class, included
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Interface
Return a new instance of Interface.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/vedeu/models/view/interface.rb', line 59 def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @colour = @attributes[:colour] @delay = @attributes[:delay] @group = @attributes[:group] @lines = @attributes[:lines] @name = @attributes[:name] @parent = @attributes[:parent] @repository = Vedeu.interfaces @style = @attributes[:style] end |
Instance Attribute Details
#colour ⇒ Object
Returns the value of attribute colour.
27 28 29 |
# File 'lib/vedeu/models/view/interface.rb', line 27 def colour @colour end |
#delay ⇒ Object
Returns the value of attribute delay.
27 28 29 |
# File 'lib/vedeu/models/view/interface.rb', line 27 def delay @delay end |
#group ⇒ Object
Returns the value of attribute group.
27 28 29 |
# File 'lib/vedeu/models/view/interface.rb', line 27 def group @group end |
#lines ⇒ Vedeu::Lines Also known as: content, value
123 124 125 |
# File 'lib/vedeu/models/view/interface.rb', line 123 def lines collection.coerce(@lines, self) end |
#name ⇒ Object
Returns the value of attribute name.
27 28 29 |
# File 'lib/vedeu/models/view/interface.rb', line 27 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
27 28 29 |
# File 'lib/vedeu/models/view/interface.rb', line 27 def parent @parent end |
#style ⇒ Object
Returns the value of attribute style.
27 28 29 |
# File 'lib/vedeu/models/view/interface.rb', line 27 def style @style end |
Instance Method Details
#add(child) ⇒ void
74 75 76 |
# File 'lib/vedeu/models/view/interface.rb', line 74 def add(child) @lines = lines.add(child) end |
#attributes ⇒ Hash
This may be unused. (GL 2015-02-20)
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/vedeu/models/view/interface.rb', line 82 def attributes { colour: colour, delay: delay, group: group, name: name, parent: parent, style: style, } end |
#border ⇒ Vedeu::Border|NilClass
Returns the border object belonging to the interface.
103 104 105 106 107 |
# File 'lib/vedeu/models/view/interface.rb', line 103 def border if border? Vedeu.borders.find(name) end end |
#border? ⇒ Boolean
Returns a boolean indicating whether the interface has a border.
96 97 98 |
# File 'lib/vedeu/models/view/interface.rb', line 96 def border? Vedeu.borders.registered?(name) end |
#cursor ⇒ Vedeu::Cursor
Fetch the cursor belonging to this interface (by name), if one does not exist, it will be created, stored and returned.
113 114 115 |
# File 'lib/vedeu/models/view/interface.rb', line 113 def cursor Vedeu.cursors.by_name(name) end |
#defaults ⇒ Hash (private)
The default values for a new instance of this class.
151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/vedeu/models/view/interface.rb', line 151 def defaults { client: nil, colour: nil, delay: 0.0, group: '', lines: [], name: '', parent: nil, style: nil, } end |
#geometry ⇒ Vedeu::Geometry
118 119 120 |
# File 'lib/vedeu/models/view/interface.rb', line 118 def geometry Vedeu.geometries.find(name) end |
#lines? ⇒ Boolean
Returns a boolean indicating whether the interface has content.
132 133 134 |
# File 'lib/vedeu/models/view/interface.rb', line 132 def lines? lines.any? end |
#store ⇒ Interface
137 138 139 140 141 142 143 144 |
# File 'lib/vedeu/models/view/interface.rb', line 137 def store super store_new_buffer store_focusable store_cursor store_group end |