Class: Vedeu::Interface
Overview
An Interface represents a portion of the terminal defined by Geometry. It is a container for Line and Stream objects.
Instance Attribute Summary collapse
Attributes included from Model
#repository
Instance Method Summary
collapse
#store_cursor, #store_deferred, #store_focusable, #store_group, #store_immediate, #store_new_buffer
Methods included from Common
#defined_value?
#_colour, #_style, #background, #background=, #colour, #colour=, #foreground, #foreground=, #parent_background, #parent_colour, #parent_foreground, #parent_style, #render_colour, #render_position, #render_style, #style, #style=, #to_s
Methods included from Model
#demodulize, #deputy, #dsl_class, included
Constructor Details
Return a new instance of Vedeu::Interface.
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/vedeu/models/interface.rb', line 66
def initialize(attributes = {})
@attributes = defaults.merge!(attributes)
@client = @attributes[:client]
@delay = @attributes[:delay]
@group = @attributes[:group]
@lines = @attributes[:lines]
@name = @attributes[:name]
@parent = @attributes[:parent]
@repository = @attributes[:repository]
@visible = @attributes[:visible]
end
|
Instance Attribute Details
#attributes ⇒ Hash
46
47
48
|
# File 'lib/vedeu/models/interface.rb', line 46
def attributes
@attributes
end
|
#client ⇒ Fixnum|Float
21
22
23
|
# File 'lib/vedeu/models/interface.rb', line 21
def client
@client
end
|
#delay ⇒ Fixnum|Float
25
26
27
|
# File 'lib/vedeu/models/interface.rb', line 25
def delay
@delay
end
|
#group ⇒ void
This method returns an undefined value.
29
30
31
|
# File 'lib/vedeu/models/interface.rb', line 29
def group
@group
end
|
#lines ⇒ Vedeu::Lines
Also known as:
content, value
86
87
88
|
# File 'lib/vedeu/models/interface.rb', line 86
def lines
collection.coerce(@lines, self)
end
|
#name ⇒ String
33
34
35
|
# File 'lib/vedeu/models/interface.rb', line 33
def name
@name
end
|
37
38
39
|
# File 'lib/vedeu/models/interface.rb', line 37
def parent
@parent
end
|
#visible ⇒ Boolean
Also known as:
visible?
Returns Whether the interface is visible.
41
42
43
|
# File 'lib/vedeu/models/interface.rb', line 41
def visible
@visible
end
|
Instance Method Details
#add(child) ⇒ void
This method returns an undefined value.
81
82
83
|
# File 'lib/vedeu/models/interface.rb', line 81
def add(child)
@lines = lines.add(child)
end
|
#cursor ⇒ Object
134
135
136
|
# File 'lib/vedeu/models/interface.rb', line 134
def cursor
@cursor ||= Vedeu.cursors.by_name(name)
end
|
#defaults ⇒ Hash
The default values for a new instance of this class.
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/vedeu/models/interface.rb', line 141
def defaults
{
client: nil,
colour: nil,
delay: 0.0,
group: '',
lines: [],
name: '',
parent: nil,
repository: Vedeu.interfaces,
style: nil,
visible: true,
}
end
|
#group? ⇒ Boolean
Returns a boolean indicating whether the interface belongs to a group.
105
106
107
|
# File 'lib/vedeu/models/interface.rb', line 105
def group?
!group.nil? && !group.empty?
end
|
#hide_cursor ⇒ String
157
158
159
160
161
|
# File 'lib/vedeu/models/interface.rb', line 157
def hide_cursor
return cursor.hide_cursor if cursor.visible?
''
end
|
#lines? ⇒ Boolean
Also known as:
content?, value?
Returns a boolean indicating whether the interface has content.
95
96
97
|
# File 'lib/vedeu/models/interface.rb', line 95
def lines?
lines.any?
end
|
#show_cursor ⇒ String
164
165
166
167
168
|
# File 'lib/vedeu/models/interface.rb', line 164
def show_cursor
return cursor.show_cursor if cursor.visible?
''
end
|
123
124
125
126
127
128
129
130
|
# File 'lib/vedeu/models/interface.rb', line 123
def store
super
store_new_buffer
store_focusable
store_cursor
store_group
end
|