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
- #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.
- #attributes ⇒ Hash<Symbol => void>
-
#background ⇒ Vedeu::Colours::Background
included
from Presentation::Colour
private
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
private
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
-
#become(klass, attributes) ⇒ Class
included
from Common
private
Converts one class into another.
-
#boolean(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating the value was a boolean.
-
#boolean?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Boolean.
- #colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour private
-
#colour=(value) ⇒ Vedeu::Colours::Colour
included
from Presentation::Colour
private
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
- #colour? ⇒ Boolean included from Presentation::Colour private
-
#defaults ⇒ Hash<Symbol => void>
private
The default values for a new instance of this class.
-
#deputy(client = nil) ⇒ Vedeu::Interfaces::DSL
Returns a DSL instance responsible for defining the DSL methods of this model.
-
#escape?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is an escape sequence object (e.g. Cells::Escape.).
-
#falsy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered false.
-
#foreground ⇒ Vedeu::Colours::Foreground
included
from Presentation::Colour
private
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
private
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
-
#hash?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Hash.
-
#hide ⇒ void
Hide the named interface.
-
#initialize(attributes = {}) ⇒ Vedeu::Interfaces::Interface
constructor
Return a new instance of Vedeu::Interfaces::Interface.
-
#line_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Line.
- #named_colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour private private
- #named_colour? ⇒ Boolean included from Presentation::Colour private private
-
#numeric?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #parent_colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour private private
- #parent_colour? ⇒ Boolean included from Presentation::Colour private private
-
#position ⇒ Vedeu::Geometries::Position
included
from Presentation::Position
private
Gets the position.
-
#position=(value) ⇒ Vedeu::Geometries::Position
included
from Presentation::Position
private
Sets the position.
-
#position? ⇒ Boolean
included
from Presentation::Position
private
Returns a boolean indicating the position attribute of the including model is set.
-
#present?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable has a useful value.
-
#render_colour(&block) ⇒ String
included
from Presentation
private
Renders the colour attributes of the receiver and yields (to then render the styles).
- #render_position(&block) ⇒ String included from Presentation private
-
#render_style(&block) ⇒ 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(klass) ⇒ String
included
from Common
private
Converts a class name to a lowercase snake case string.
-
#store(&block) ⇒ void
included
from Repositories::Model
The model instance stored in the repository.
-
#stream_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Stream.
-
#string?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
-
#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 ⇒ Boolean
included
from Toggleable
Toggle the visible state and store the model.
-
#truthy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered true.
-
#view_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::View.
-
#x ⇒ Fixnum|NilClass
included
from Presentation::Position
private
Returns the x coordinate for the model when the position attribute of the including model is set.
-
#y ⇒ Fixnum|NilClass
included
from Presentation::Position
private
Returns the y coordinate for the model when the position attribute of the including model is set.
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Interfaces::Interface
Return a new instance of Vedeu::Interfaces::Interface.
65 66 67 68 69 |
# File 'lib/vedeu/interfaces/interface.rb', line 65 def initialize(attributes = {}) defaults.merge!(attributes).each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#client ⇒ Fixnum|Float
18 19 20 |
# File 'lib/vedeu/interfaces/interface.rb', line 18 def client @client end |
#cursor_visible ⇒ Boolean Also known as: cursor_visible?
22 23 24 |
# File 'lib/vedeu/interfaces/interface.rb', line 22 def cursor_visible @cursor_visible end |
#delay ⇒ Fixnum|Float
27 28 29 |
# File 'lib/vedeu/interfaces/interface.rb', line 27 def delay @delay end |
#editable ⇒ Boolean Also known as: editable?
31 32 33 |
# File 'lib/vedeu/interfaces/interface.rb', line 31 def editable @editable end |
#group ⇒ Symbol|String
36 37 38 |
# File 'lib/vedeu/interfaces/interface.rb', line 36 def group @group end |
#name ⇒ String
40 41 42 |
# File 'lib/vedeu/interfaces/interface.rb', line 40 def name @name end |
#parent ⇒ Vedeu::Views::Composition
44 45 46 |
# File 'lib/vedeu/interfaces/interface.rb', line 44 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
48 49 50 |
# File 'lib/vedeu/interfaces/interface.rb', line 48 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.
#attributes ⇒ Hash<Symbol => void>
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/vedeu/interfaces/interface.rb', line 72 def attributes { client: client, colour: colour, cursor_visible: cursor_visible, delay: delay, editable: editable, group: group, name: name, parent: parent, repository: repository, style: style, visible: visible, zindex: zindex, } end |
#background ⇒ Vedeu::Colours::Background Originally defined in module Presentation::Colour
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.
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
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.
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
#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.
#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.
#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.
#colour ⇒ Vedeu::Colours::Colour Originally defined in module Presentation::Colour
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.
#colour=(value) ⇒ Vedeu::Colours::Colour Originally defined in module Presentation::Colour
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.
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
#colour? ⇒ Boolean Originally defined in module Presentation::Colour
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.
#defaults ⇒ Hash<Symbol => void> (private)
The default values for a new instance of this class.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/vedeu/interfaces/interface.rb', line 146 def defaults { client: nil, colour: Vedeu.config.colour, cursor_visible: true, delay: 0.0, editable: false, group: '', name: '', parent: nil, repository: Vedeu.interfaces, style: :normal, visible: true, zindex: 0, } end |
#deputy(client = nil) ⇒ Vedeu::Interfaces::DSL
Returns a DSL instance responsible for defining the DSL methods of this model.
98 99 100 |
# File 'lib/vedeu/interfaces/interface.rb', line 98 def deputy(client = nil) Vedeu::Interfaces::DSL.new(self, client) 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.)
#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.
#foreground ⇒ Vedeu::Colours::Foreground Originally defined in module Presentation::Colour
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.
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
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.
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
#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.
#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.
115 116 117 118 119 |
# File 'lib/vedeu/interfaces/interface.rb', line 115 def hide super Vedeu.trigger(:_clear_view_, 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.
#named_colour ⇒ Vedeu::Colours::Colour (private) Originally defined in module Presentation::Colour
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.
#named_colour? ⇒ Boolean (private) Originally defined in module Presentation::Colour
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.
#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.
#parent_colour ⇒ Vedeu::Colours::Colour (private) Originally defined in module Presentation::Colour
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.
#parent_colour? ⇒ Boolean (private) Originally defined in module Presentation::Colour
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.
#position ⇒ Vedeu::Geometries::Position Originally defined in module Presentation::Position
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.
Gets the position.
#position=(value) ⇒ Vedeu::Geometries::Position Originally defined in module Presentation::Position
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.
Sets the position.
#position? ⇒ Boolean Originally defined in module Presentation::Position
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 position attribute of the including model is set.
#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(&block) ⇒ String (private) Originally defined in module Presentation
Renders the colour attributes of the receiver and yields (to then render the styles).
#render_position(&block) ⇒ String (private) Originally defined in module Presentation
#render_style(&block) ⇒ 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.
135 136 137 138 139 |
# File 'lib/vedeu/interfaces/interface.rb', line 135 def show super Vedeu.trigger(:_refresh_view_, name) end |
#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.
#store(&block) ⇒ 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.
#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.
#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.
#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 ⇒ Boolean 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.
#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.
#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.
#x ⇒ Fixnum|NilClass Originally defined in module Presentation::Position
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 the x coordinate for the model when the position attribute of the including model is set.
#y ⇒ Fixnum|NilClass Originally defined in module Presentation::Position
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 the y coordinate for the model when the position attribute of the including model is set.