Class: Vedeu::Visibility

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/support/visibility.rb

Overview

Change the visibility of the given model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Vedeu::Visibility

Parameters:

  • model (void)


34
35
36
# File 'lib/vedeu/support/visibility.rb', line 34

def initialize(model)
  @model = model
end

Instance Attribute Details

#modelvoid (readonly, protected)

This method returns an undefined value.



76
77
78
# File 'lib/vedeu/support/visibility.rb', line 76

def model
  @model
end

Class Method Details

.for_cursor(name = nil) ⇒ Vedeu::Visibility

Parameters:

  • name (String) (defaults to: nil)

Returns:



8
9
10
11
12
# File 'lib/vedeu/support/visibility.rb', line 8

def self.for_cursor(name = nil)
  named = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor

  new(named)
end

.hide(model) ⇒ void

This method returns an undefined value.

Parameters:

  • model (void)


22
23
24
# File 'lib/vedeu/support/visibility.rb', line 22

def self.hide(model)
  new(model).hide
end

.show(model) ⇒ void

This method returns an undefined value.

Parameters:

  • model (void)


16
17
18
# File 'lib/vedeu/support/visibility.rb', line 16

def self.show(model)
  new(model).show
end

.toggle(model) ⇒ void

This method returns an undefined value.

Parameters:

  • model (void)


28
29
30
# File 'lib/vedeu/support/visibility.rb', line 28

def self.toggle(model)
  new(model).toggle
end

Instance Method Details

#hidevoid

This method returns an undefined value.



56
57
58
59
# File 'lib/vedeu/support/visibility.rb', line 56

def hide
  model.visible = false
  model.store
end

#showvoid

This method returns an undefined value.



39
40
41
42
# File 'lib/vedeu/support/visibility.rb', line 39

def show
  model.visible = true
  model.store
end

#stateSymbol

Returns:

  • (Symbol)


45
46
47
48
49
50
51
52
53
# File 'lib/vedeu/support/visibility.rb', line 45

def state
  if model.visible?
    :visible

  else
    :invisible

  end
end

#togglevoid

This method returns an undefined value.



62
63
64
65
66
67
68
69
70
# File 'lib/vedeu/support/visibility.rb', line 62

def toggle
  if model.visible?
    hide

  else
    show

  end
end