Class: Vedeu::Models::Interface

Inherits:
Object
  • Object
show all
Includes:
Vedeu::Model, Presentation, Toggleable
Defined in:
lib/vedeu/models/interface.rb,
lib/vedeu/models/interfaces.rb

Overview

Interfaces

Instance Attribute Summary collapse

Attributes included from Toggleable

#visible

Attributes included from Vedeu::Model

#repository

Instance Method Summary collapse

Methods included from Toggleable

included

Methods included from Presentation

#render_colour, #render_position, #render_style, #to_s

Methods included from Presentation::Styles

#style, #style=

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.

Parameters:

  • attributes (Hash) (defaults to: {})

Options Hash (attributes):



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

#attributesHash (readonly)

Returns:

  • (Hash)


16
17
18
# File 'lib/vedeu/models/interface.rb', line 16

def attributes
  @attributes
end

#clientFixnum|Float

Returns:

  • (Fixnum|Float)


20
21
22
# File 'lib/vedeu/models/interface.rb', line 20

def client
  @client
end

#delayFixnum|Float

Returns:

  • (Fixnum|Float)


24
25
26
# File 'lib/vedeu/models/interface.rb', line 24

def delay
  @delay
end

#groupSymbol|String

Returns:

  • (Symbol|String)


28
29
30
# File 'lib/vedeu/models/interface.rb', line 28

def group
  @group
end

#nameString

Returns:

  • (String)


32
33
34
# File 'lib/vedeu/models/interface.rb', line 32

def name
  @name
end

#parentVedeu::Views::Composition



36
37
38
# File 'lib/vedeu/models/interface.rb', line 36

def parent
  @parent
end

#zindexFixnum

Returns:

  • (Fixnum)


40
41
42
# File 'lib/vedeu/models/interface.rb', line 40

def zindex
  @zindex
end

Instance Method Details

#defaultsHash (private)

The default values for a new instance of this class.

Returns:

  • (Hash)


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

#hidevoid

This method returns an undefined value.

Hide a named interface buffer, or without a name, the buffer of the currently focussed interface.

Examples:

Vedeu.hide_interface(name)


71
72
73
74
75
# File 'lib/vedeu/models/interface.rb', line 71

def hide
  super

  Vedeu.buffers.by_name(name).hide
end

#showvoid

This method returns an undefined value.

Show the named interface buffer, or without a name, the buffer of the currently focussed interface.

Examples:

Vedeu.show_interface(name)


84
85
86
87
88
# File 'lib/vedeu/models/interface.rb', line 84

def show
  super

  Vedeu.buffers.by_name(name).show
end

#togglevoid

This method returns an undefined value.

Toggle the visibility of the interface with the given name.

Examples:

Vedeu.toggle_interface(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