Class: Vedeu::Groups::Refresh

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vedeu/groups/refresh.rb

Overview

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

Constructor Details

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

Return a new instance of Vedeu::Groups::Refresh.

Parameters:

  • name (String|Symbol)


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

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameString|Symbol (readonly, protected)

Returns:

  • (String|Symbol)


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

def name
  @name
end

Class Method Details

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

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

Parameters:

  • name (String|Symbol)

    The name of the group to be refreshed.

Returns:

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

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



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

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

Instance Method Details

#absent?(variable) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether a variable is nil or empty.

Parameters:

  • variable (String|Symbol|Array|Fixnum)

    The variable to check.

Returns:

#become(klass, attributes) ⇒ Class Originally defined in module Common

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.

Converts one class into another.

Parameters:

  • klass (Class)

    The class to become an instance of.

  • attributes (Hash)

    The attributes of klass.

Returns:

  • (Class)

    Returns a new instance of klass.

#boolean(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating the value was a boolean.

Parameters:

  • value (void)

Returns:

#boolean?(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether the value is a Boolean.

Parameters:

Returns:

#by_namevoid

This method returns an undefined value.



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

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

#escape?(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether the value is an escape sequence object (e.g. Vedeu::Cells::Escape.)

Returns:

#falsy?(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether the value should be considered false.

Parameters:

  • value (void)

Returns:

#group_from_interfaceString|Symbol (private)

Returns:

  • (String|Symbol)


66
67
68
# File 'lib/vedeu/groups/refresh.rb', line 66

def group_from_interface
  @_group_name ||= interface.group
end

#group_nameString (private)

Returns:

  • (String)

Raises:



57
58
59
60
61
62
63
# File 'lib/vedeu/groups/refresh.rb', line 57

def group_name
  return name if present?(name)
  return group_from_interface if present?(group_from_interface)

  fail Vedeu::Error::MissingRequired,
       'Cannot refresh group with an empty group name.'
end

#hash?(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether the value is a Hash.

Parameters:

  • value (Hash|void)

Returns:

#interfaceVedeu::Interfaces::Interface (private)



71
72
73
# File 'lib/vedeu/groups/refresh.rb', line 71

def interface
  Vedeu.interfaces.by_name(name)
end

#line_model?Boolean Originally defined in module Common

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 boolean indicating the model is a Views::Line.

Returns:

#numeric?(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether the value is a Fixnum.

Parameters:

  • value (Fixnum|void)

Returns:

#present?(variable) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether a variable has a useful value.

Parameters:

  • variable (String|Symbol|Array|Fixnum)

    The variable to check.

Returns:

#snake_case(klass) ⇒ String Originally defined in module Common

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.

Converts a class name to a lowercase snake case string.

Examples:

snake_case(MyClassName) # => "my_class_name"
snake_case(NameSpaced::ClassName)
# => "name_spaced/class_name"

snake_case('MyClassName') # => "my_class_name"
snake_case(NameSpaced::ClassName)
# => "name_spaced/class_name"

Parameters:

  • klass (Module|Class|String)

Returns:

  • (String)

#stream_model?Boolean Originally defined in module Common

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 boolean indicating the model is a Views::Stream.

Returns:

#string?(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether the value is a Fixnum.

Parameters:

  • value (String|void)

Returns:

#truthy?(value) ⇒ Boolean Originally defined in module Common

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 boolean indicating whether the value should be considered true.

Parameters:

  • value (void)

Returns:

#view_model?Boolean Originally defined in module Common

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 boolean indicating the model is a Views::View.

Returns: