Class: Vedeu::Groups::Refresh Private

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vedeu/groups/refresh.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.

Refresh an interface, or collection of interfaces belonging to a group.

The interfaces will be refreshed in z-index order, meaning that interfaces with a lower z-index will be drawn first. This means overlapping interfaces will be drawn as specified.

Examples:

Vedeu.trigger(:_refresh_group_, group_name)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?

Constructor Details

#initialize(name) ⇒ Vedeu::Groups::Refresh

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 new instance of Vedeu::Groups::Refresh.

Parameters:

  • name (NilClass|Symbol|String)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.



35
36
37
# File 'lib/vedeu/groups/refresh.rb', line 35

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameNilClass|Symbol|String (readonly, protected)

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 The name of the model, the target model or the name of the associated model.

Returns:

  • (NilClass|Symbol|String)

    The name of the model, the target model or the name of the associated model.



52
53
54
# File 'lib/vedeu/groups/refresh.rb', line 52

def name
  @name
end

Class Method Details

.by_name(name) ⇒ Array|Vedeu::Error::ModelNotFound

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 collection of the names of interfaces refreshed, or an exception when the group was not found.

Parameters:

  • name (NilClass|Symbol|String)

    The name of the model or target model to act upon. May default to ‘Vedeu.focus`.

Returns:

  • (Array|Vedeu::Error::ModelNotFound)

    A collection of the names of interfaces refreshed, or an exception when the group was not found.



27
28
29
# File 'lib/vedeu/groups/refresh.rb', line 27

def self.by_name(name)
  new(name).by_name
end

Instance Method Details

#by_namevoid

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.

This method returns an undefined value.



40
41
42
43
44
45
46
# File 'lib/vedeu/groups/refresh.rb', line 40

def by_name
  Vedeu.timer("Refresh Group: '#{group_name}'") do
    Vedeu.groups.by_name(group_name).by_zindex.each do |name|
      Vedeu.trigger(:_refresh_view_, name)
    end
  end
end

#group_nameString (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.

Returns:

  • (String)

Raises:



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/vedeu/groups/refresh.rb', line 58

def group_name
  if present?(name)
    name

  elsif present?(interface.group)
    interface.group

  else
    raise Vedeu::Error::MissingRequired,
          'Cannot refresh group with an empty group name.'

  end
end

#interfaceVedeu::Interfaces::Interface (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.

Returns the named interface/view from the interfaces repository.



73
74
75
# File 'lib/vedeu/groups/refresh.rb', line 73

def interface
  Vedeu.interfaces.by_name(name)
end