Class: Vedeu::Buffers::Refresh

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

Overview

Refreshes the given named interface.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

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

Options Hash (options):

  • content_only (Boolean)


40
41
42
43
# File 'lib/vedeu/buffers/refresh.rb', line 40

def initialize(name, options = {})
  @name    = present?(name) ? name : Vedeu.focus
  @options = options
end

Instance Attribute Details

#nameString|Symbol (readonly, protected)



58
59
60
# File 'lib/vedeu/buffers/refresh.rb', line 58

def name
  @name
end

Class Method Details

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

Examples:

Vedeu.trigger(:_refresh_view_, name)


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

Examples:

Vedeu.trigger(:_refresh_view_content_, name)


27
28
29
30
31
# File 'lib/vedeu/buffers/refresh.rb', line 27

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.

#by_nameArray|Vedeu::Error::ModelNotFound



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

def by_name
  Vedeu.trigger(:_clear_view_content_, name)

  Vedeu.buffers.by_name(name).render

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

#content_only?Boolean (protected)



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

def content_only?
  options[:content_only] == true
end

#defaultsHash<Symbol => Boolean> (protected)



71
72
73
74
75
# File 'lib/vedeu/buffers/refresh.rb', line 71

def defaults
  {
    content_only: false
  }
end

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

Removes the module part from the expression in the string.

Examples:

demodulize('Vedeu::SomeModule::SomeClass') # => "SomeClass"

#optionsHash<Symbol => Boolean> (protected)



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

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.

#snake_case(name) ⇒ 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"