Class: Vedeu::Models::Interface
- Inherits:
-
Object
- Object
- Vedeu::Models::Interface
- Includes:
- Vedeu::Model, Presentation, Toggleable
- Defined in:
- lib/vedeu/models/interface.rb,
lib/vedeu/models/interfaces.rb
Overview
Interfaces
Instance Attribute Summary collapse
- #attributes ⇒ Hash readonly
- #client ⇒ Fixnum|Float
- #delay ⇒ Fixnum|Float
- #group ⇒ Symbol|String
- #name ⇒ String
- #parent ⇒ Vedeu::Views::Composition
- #zindex ⇒ Fixnum
Attributes included from Toggleable
Attributes included from Vedeu::Model
Instance Method Summary collapse
-
#defaults ⇒ Hash
private
The default values for a new instance of this class.
-
#hide ⇒ void
Hide a named interface buffer, or without a name, the buffer of the currently focussed interface.
-
#initialize(attributes = {}) ⇒ Vedeu::Models::Interface
constructor
Return a new instance of Vedeu::Models::Interface.
-
#show ⇒ void
Show the named interface buffer, or without a name, the buffer of the currently focussed interface.
-
#toggle ⇒ void
Toggle the visibility of the interface with the given name.
Methods included from Toggleable
Methods included from Presentation
#render_colour, #render_position, #render_style, #to_s
Methods included from Presentation::Styles
Methods included from Presentation::Colour
#background, #background=, #colour, #colour=, #foreground, #foreground=
Methods included from Vedeu::Model
#deputy, #dsl_class, included, #store
Methods included from Common
#demodulize, #present?, #snake_case
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Models::Interface
Return a new instance of Vedeu::Models::Interface.
56 57 58 59 60 61 62 |
# File 'lib/vedeu/models/interface.rb', line 56 def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @attributes.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#attributes ⇒ Hash (readonly)
16 17 18 |
# File 'lib/vedeu/models/interface.rb', line 16 def attributes @attributes end |
#client ⇒ Fixnum|Float
20 21 22 |
# File 'lib/vedeu/models/interface.rb', line 20 def client @client end |
#delay ⇒ Fixnum|Float
24 25 26 |
# File 'lib/vedeu/models/interface.rb', line 24 def delay @delay end |
#group ⇒ Symbol|String
28 29 30 |
# File 'lib/vedeu/models/interface.rb', line 28 def group @group end |
#name ⇒ String
32 33 34 |
# File 'lib/vedeu/models/interface.rb', line 32 def name @name end |
#parent ⇒ Vedeu::Views::Composition
36 37 38 |
# File 'lib/vedeu/models/interface.rb', line 36 def parent @parent end |
#zindex ⇒ Fixnum
40 41 42 |
# File 'lib/vedeu/models/interface.rb', line 40 def zindex @zindex end |
Instance Method Details
#defaults ⇒ Hash (private)
The default values for a new instance of this class.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/vedeu/models/interface.rb', line 111 def defaults { client: nil, colour: Vedeu::Colours::Colour.coerce(background: :default, foreground: :default), delay: 0.0, group: '', name: '', parent: nil, repository: Vedeu.interfaces, style: :normal, visible: true, zindex: 0, } end |
#hide ⇒ void
This method returns an undefined value.
Hide a named interface buffer, or without a name, the buffer of the currently focussed interface.
71 72 73 74 75 |
# File 'lib/vedeu/models/interface.rb', line 71 def hide super Vedeu.buffers.by_name(name).hide end |
#show ⇒ void
This method returns an undefined value.
Show the named interface buffer, or without a name, the buffer of the currently focussed interface.
84 85 86 87 88 |
# File 'lib/vedeu/models/interface.rb', line 84 def show super Vedeu.buffers.by_name(name).show end |
#toggle ⇒ void
This method returns an undefined value.
Toggle the visibility of the interface with the given name.
96 97 98 99 100 101 102 103 104 |
# File 'lib/vedeu/models/interface.rb', line 96 def toggle if visible? hide else show end end |