Class: Vedeu::Buffers::Refresh

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

Overview

Refreshes the given named interface.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Vedeu::Buffers::Refresh

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

Parameters:

  • name (String|Symbol)

    The name of the interface/view to be refreshed. Defaults to ‘Vedeu.focus`.

  • options (Hash<Symbol => Boolean>) (defaults to: {})

Options Hash (options):



38
39
40
41
# File 'lib/vedeu/buffers/refresh.rb', line 38

def initialize(name, options = {})
  @name    = name
  @options = options
end

Class Method Details

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

Parameters:

  • name (String|Symbol) (defaults to: Vedeu.focus)

    The name of the interface/view to be refreshed. Defaults to ‘Vedeu.focus`.

  • options (Hash<Symbol => Boolean>)

Returns:



16
17
18
19
20
# File 'lib/vedeu/buffers/refresh.rb', line 16

def self.by_name(name = Vedeu.focus)
  name ||= Vedeu.focus

  new(name).by_name
end

.refresh_content_by_name(name = Vedeu.focus) ⇒ Array|Vedeu::Error::ModelNotFound

Parameters:

  • name (String|Symbol) (defaults to: Vedeu.focus)

    The name of the interface/view to be refreshed. Defaults to ‘Vedeu.focus`.

  • options (Hash<Symbol => Boolean>)

Returns:



25
26
27
28
29
# File 'lib/vedeu/buffers/refresh.rb', line 25

def self.refresh_content_by_name(name = Vedeu.focus)
  name ||= Vedeu.focus

  new(name, content_only: true).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:

#bufferVedeu::Buffers::Buffer (private)



55
56
57
# File 'lib/vedeu/buffers/refresh.rb', line 55

def buffer
  Vedeu.buffers.by_name(name)
end

#by_nameArray|Vedeu::Error::ModelNotFound

Returns:



44
45
46
47
48
49
50
# File 'lib/vedeu/buffers/refresh.rb', line 44

def by_name
  Vedeu.trigger(:_clear_view_content_, name)

  buffer.render

  Vedeu.trigger(:_refresh_border_, name) unless content_only?
end

#content_only?Boolean (private)

Returns:



60
61
62
# File 'lib/vedeu/buffers/refresh.rb', line 60

def content_only?
  truthy?(options[:content_only])
end

#defaultsHash<Symbol => Boolean> (private)

Returns:



75
76
77
78
79
# File 'lib/vedeu/buffers/refresh.rb', line 75

def defaults
  {
    content_only: false,
  }
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:

#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:

#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:

#nameString|Symbol (private)

Returns:

  • (String|Symbol)


65
66
67
# File 'lib/vedeu/buffers/refresh.rb', line 65

def name
  present?(@name) ? @name : Vedeu.focus
end

#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:

#optionsHash<Symbol => Boolean> (private)

Returns:



70
71
72
# File 'lib/vedeu/buffers/refresh.rb', line 70

def options
  defaults.merge!(@options)
end

#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: