Class: Vedeu::Interfaces::Interface
- Inherits:
-
Object
- Object
- Vedeu::Interfaces::Interface
- Includes:
- Presentation, Repositories::Model, Toggleable
- Defined in:
- lib/vedeu/interfaces/interface.rb,
lib/vedeu/interfaces/repository.rb
Overview
Interfaces
Instance Attribute Summary collapse
- #attributes ⇒ Hash readonly
- #client ⇒ Fixnum|Float
- #cursor_visible ⇒ Boolean (also: #cursor_visible?)
- #delay ⇒ Fixnum|Float
- #editable ⇒ Boolean (also: #editable?)
- #group ⇒ Symbol|String
- #name ⇒ String
- #parent ⇒ Vedeu::Views::Composition
- #repository ⇒ Vedeu::Repositories::Repository included from Repositories::Model
-
#visible ⇒ Boolean
(also: #visible?)
included
from Toggleable
Whether the toggleable is visible.
- #zindex ⇒ Fixnum
Instance Method Summary collapse
-
#absent?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable is nil or empty.
-
#background ⇒ Vedeu::Colours::Background
included
from Presentation::Colour
When the background colour for the model exists, return it, otherwise returns the parent background colour, or an empty Vedeu::Colours::Background.
-
#background=(value) ⇒ Vedeu::Colours::Background
included
from Presentation::Colour
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
- #colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour
-
#colour=(value) ⇒ Vedeu::Colours::Colour
included
from Presentation::Colour
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
-
#defaults ⇒ Hash
private
The default values for a new instance of this class.
-
#demodulize(klass) ⇒ String
included
from Common
private
Removes the module part from the expression in the string.
-
#deputy(client = nil) ⇒ Vedeu::Interfaces::DSL
Returns a DSL instance responsible for defining the DSL methods of this model.
-
#foreground ⇒ Vedeu::Colours::Foreground
included
from Presentation::Colour
When the foreground colour for the model exists, return it, otherwise returns the parent foreground colour, or an empty Vedeu::Colours::Foreground.
-
#foreground=(value) ⇒ Vedeu::Colours::Foreground
included
from Presentation::Colour
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
-
#hide ⇒ void
Hide the named interface.
-
#initialize(attributes = {}) ⇒ Vedeu::Interfaces::Interface
constructor
Return a new instance of Vedeu::Interfaces::Interface.
-
#position? ⇒ Boolean
included
from Presentation
private
Returns a boolean indicating the model has a position attribute.
-
#present?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable has a useful value.
-
#render_colour ⇒ String
included
from Presentation
private
Renders the colour attributes of the receiver and yields (to then render the styles).
- #render_position ⇒ String included from Presentation private
-
#render_style ⇒ String
included
from Presentation
private
Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).
-
#show ⇒ void
Show the named interface.
-
#snake_case(name) ⇒ String
included
from Common
private
Converts a class name to a lowercase snake case string.
-
#store ⇒ void
included
from Repositories::Model
The model instance stored in the repository.
-
#style ⇒ Vedeu::Presentation::Style
included
from Presentation::Styles
When the style for the model exists, return it, otherwise returns the parent style, or an empty Presentation::Style.
-
#style=(value) ⇒ Vedeu::Presentation::Style
included
from Presentation::Styles
Allows the setting of the style by coercing the given value into a Presentation::Style.
-
#to_s ⇒ String
(also: #to_str)
included
from Presentation
Converts the colours and styles to escape sequences, and when the parent model has previously set the colour and style, reverts back to that for consistent formatting.
-
#toggle ⇒ FalseClass|TrueClass
included
from Toggleable
Toggle the visible state and store the model.
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Interfaces::Interface
Return a new instance of Vedeu::Interfaces::Interface.
67 68 69 70 71 72 73 |
# File 'lib/vedeu/interfaces/interface.rb', line 67 def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @attributes.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#attributes ⇒ Hash (readonly)
16 17 18 |
# File 'lib/vedeu/interfaces/interface.rb', line 16 def attributes @attributes end |
#client ⇒ Fixnum|Float
20 21 22 |
# File 'lib/vedeu/interfaces/interface.rb', line 20 def client @client end |
#cursor_visible ⇒ Boolean Also known as: cursor_visible?
24 25 26 |
# File 'lib/vedeu/interfaces/interface.rb', line 24 def cursor_visible @cursor_visible end |
#delay ⇒ Fixnum|Float
29 30 31 |
# File 'lib/vedeu/interfaces/interface.rb', line 29 def delay @delay end |
#editable ⇒ Boolean Also known as: editable?
33 34 35 |
# File 'lib/vedeu/interfaces/interface.rb', line 33 def editable @editable end |
#group ⇒ Symbol|String
38 39 40 |
# File 'lib/vedeu/interfaces/interface.rb', line 38 def group @group end |
#name ⇒ String
42 43 44 |
# File 'lib/vedeu/interfaces/interface.rb', line 42 def name @name end |
#parent ⇒ Vedeu::Views::Composition
46 47 48 |
# File 'lib/vedeu/interfaces/interface.rb', line 46 def parent @parent end |
#repository ⇒ Vedeu::Repositories::Repository Originally defined in module Repositories::Model
#visible ⇒ Boolean Also known as: visible? Originally defined in module Toggleable
Returns Whether the toggleable is visible.
#zindex ⇒ Fixnum
50 51 52 |
# File 'lib/vedeu/interfaces/interface.rb', line 50 def zindex @zindex 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.
#background ⇒ Vedeu::Colours::Background Originally defined in module Presentation::Colour
When the background colour for the model exists, return it, otherwise returns the parent background colour, or an empty Vedeu::Colours::Background.
#background=(value) ⇒ Vedeu::Colours::Background Originally defined in module Presentation::Colour
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
#colour ⇒ Vedeu::Colours::Colour Originally defined in module Presentation::Colour
#colour=(value) ⇒ Vedeu::Colours::Colour Originally defined in module Presentation::Colour
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
#defaults ⇒ Hash (private)
The default values for a new instance of this class.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/vedeu/interfaces/interface.rb', line 132 def defaults { client: nil, colour: Vedeu::Configuration.colour, cursor_visible: true, delay: 0.0, editable: false, group: '', name: '', parent: nil, repository: Vedeu.interfaces, style: :normal, visible: true, zindex: 0, } 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.
#deputy(client = nil) ⇒ Vedeu::Interfaces::DSL
Returns a DSL instance responsible for defining the DSL methods of this model.
84 85 86 |
# File 'lib/vedeu/interfaces/interface.rb', line 84 def deputy(client = nil) Vedeu::Interfaces::DSL.new(self, client) end |
#foreground ⇒ Vedeu::Colours::Foreground Originally defined in module Presentation::Colour
When the foreground colour for the model exists, return it, otherwise returns the parent foreground colour, or an empty Vedeu::Colours::Foreground.
#foreground=(value) ⇒ Vedeu::Colours::Foreground Originally defined in module Presentation::Colour
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
#hide ⇒ void
This method returns an undefined value.
Hide the named interface.
Will hide the named interface. If the interface is currently visible, it will be cleared- rendered blank. To show the interface, the ‘:show_interface’ event should be triggered. Triggering the ‘:hide_group’ event to which this named interface belongs will also hide the interface.
101 102 103 104 105 |
# File 'lib/vedeu/interfaces/interface.rb', line 101 def hide super Vedeu.trigger(:_clear_view_, name) end |
#position? ⇒ Boolean (private) Originally defined in module Presentation
Returns a boolean indicating the model has a position attribute.
#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.
#render_colour ⇒ String (private) Originally defined in module Presentation
Renders the colour attributes of the receiver and yields (to then render the styles).
#render_position ⇒ String (private) Originally defined in module Presentation
#render_style ⇒ String (private) Originally defined in module Presentation
Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).
#show ⇒ void
This method returns an undefined value.
Show the named interface.
Will show the named interface. If the interface is currently visible, it will be refreshed- showing any new content available. To hide the interface, the ‘:hide_interface’ event should be triggered. Triggering the ‘:show_group’ event to which this named interface belongs will also show the interface.
121 122 123 124 125 |
# File 'lib/vedeu/interfaces/interface.rb', line 121 def show super Vedeu.trigger(:_refresh_view_, name) end |
#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.
#store ⇒ void Originally defined in module Repositories::Model
Perhaps some validation could be added here?
If a block is given, store the model, return the model after yielding.
This method returns an undefined value.
Returns The model instance stored in the repository.
#style ⇒ Vedeu::Presentation::Style Originally defined in module Presentation::Styles
When the style for the model exists, return it, otherwise returns the parent style, or an empty Vedeu::Presentation::Style.
#style=(value) ⇒ Vedeu::Presentation::Style Originally defined in module Presentation::Styles
Allows the setting of the style by coercing the given value into a Vedeu::Presentation::Style.
#to_s ⇒ String Also known as: to_str Originally defined in module Presentation
Converts the colours and styles to escape sequences, and when the parent model has previously set the colour and style, reverts back to that for consistent formatting.
#toggle ⇒ FalseClass|TrueClass Originally defined in module Toggleable
Toggle the visible state and store the model. When the model is hidden, then it is shown, and vice versa.