Class: Vedeu::Borders::DSL
- Inherits:
-
Object
- Object
- Vedeu::Borders::DSL
- Includes:
- DSL, DSL::Presentation, DSL::Use
- Defined in:
- lib/vedeu/borders/dsl.rb
Overview
Provides a mechanism to help configure borders in Vedeu.
Instance Attribute Summary collapse
-
#client ⇒ Object
included
from DSL
readonly
protected
The object instance where the DSL is being used.
-
#model ⇒ void
included
from DSL
readonly
protected
The new model object which the DSL is constructing.
Class Method Summary collapse
-
.border(name, &block) ⇒ Vedeu::Borders::Border
Specify the border of an interface or view with a simple DSL.
Instance Method Summary collapse
-
#attributes ⇒ Hash<Symbol => void>
included
from DSL
private
Returns the default attributes for the new model.
-
#background(value = '') ⇒ String
(also: #bg, #bgcolor, #background=, #bg=, #bgcolor=)
included
from DSL::Presentation
Define the background colour for an interface, line, or a stream.
-
#bottom(value) ⇒ Boolean
(also: #show_bottom, #bottom=)
Enable/disable the bottom border.
-
#bottom_left(char) ⇒ String
(also: #bottom_left=)
Set the character to be used to draw the bottom left corner of the border.
-
#bottom_right(char) ⇒ String
(also: #bottom_right=)
Set the character to be used to draw the bottom right corner of the border.
-
#caption(value) ⇒ String
(also: #caption=)
If you have you are showing a bottom border, you could add a caption.
-
#colour(attrs = {}) ⇒ Vedeu::Colours::Colour
(also: #colour=)
included
from DSL::Presentation
Define either or both foreground and background colours for an interface, line or a stream.
- #colour_attributes ⇒ Hash<Symbol => String> included from DSL::Presentation private
-
#disable! ⇒ Boolean
Disable the border:.
-
#enable! ⇒ Boolean
Enable the border: (Borders are enabled by default when defined for an interface).
- #foreground(value = '') ⇒ Object (also: #fg, #fgcolor, #foreground=, #fg=, #fgcolor=) included from DSL::Presentation
-
#hide_bottom! ⇒ Object
Disable the bottom border.
-
#hide_left! ⇒ Object
Disable the left border.
-
#hide_right! ⇒ Object
Disable the right border.
-
#hide_top! ⇒ Object
Disable the top border.
-
#horizontal(char) ⇒ String
(also: #horizontal=)
Set the character to be used to draw a horizontal part of the border.
-
#initialize(model, client = nil) ⇒ void
included
from DSL
Returns an instance of the DSL class including DSL.
-
#left(value) ⇒ Boolean
(also: #show_left, #left=)
Enable/disable the left border.
-
#method_missing(method, *args, &block) ⇒ void
included
from DSL
private
Attempts to find the missing method on the client object.
-
#right(value) ⇒ Boolean
(also: #show_right, #right=)
Enable/disable the right border.
-
#show_bottom! ⇒ Object
Enable the bottom border.
-
#show_left! ⇒ Object
Enable the left border.
-
#show_right! ⇒ Object
Enable the right border.
-
#show_top! ⇒ Object
Enable the top border.
-
#style(value) ⇒ Vedeu::Presentation::Style
(also: #style=, #styles, #styles=)
included
from DSL::Presentation
Define a style or styles for an interface, line or a stream.
-
#title(value) ⇒ String
(also: #title=)
If you have you are showing a top border, you could add a title.
-
#top(value) ⇒ Boolean
(also: #show_top, #top=)
Enable/disable the top border.
-
#top_left(char) ⇒ String
(also: #top_left=)
Set the character to be used to draw the top left corner of the border.
-
#top_right(char) ⇒ String
(also: #top_right=)
Set the character to be used to draw the top right corner of the border.
-
#use(name) ⇒ void
included
from DSL::Use
Use the attribute of stored model.
-
#vertical(char) ⇒ String
(also: #vertical=)
Set the character to be used to draw a vertical part of the border.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vedeu::DSL
Instance Attribute Details
#client ⇒ Object (readonly, protected) Originally defined in module DSL
Returns The object instance where the DSL is being used.
#model ⇒ void (readonly, protected) Originally defined in module DSL
This method returns an undefined value.
Returns The new model object which the DSL is constructing.
Class Method Details
.border(name, &block) ⇒ Vedeu::Borders::Border
24 25 26 27 28 |
# File 'lib/vedeu/borders/dsl.rb', line 24 def self.border(name, &block) fail Vedeu::Error::RequiresBlock unless block_given? Vedeu::Borders::Border.build(enabled: true, name: name, &block).store end |
Instance Method Details
#attributes ⇒ Hash<Symbol => void> (private) Originally defined in module DSL
Specific DSL classes may be overriding this method.
Returns the default attributes for the new model.
#background(value = '') ⇒ String Also known as: bg, bgcolor, background=, bg=, bgcolor= Originally defined in module DSL::Presentation
The last defined background colour for a particular interface, line or stream overrides previously defined entries in the same block.
Define the background colour for an interface, line, or a stream. When called with a block, will create a new stream with the background colour specified. When the block terminates, the background will return to that of the parent.
#bottom(value) ⇒ Boolean Also known as: show_bottom, bottom=
131 132 133 134 135 |
# File 'lib/vedeu/borders/dsl.rb', line 131 def bottom(value) boolean = value ? true : false model.show_bottom = boolean end |
#bottom_left(char) ⇒ String Also known as: bottom_left=
41 42 43 |
# File 'lib/vedeu/borders/dsl.rb', line 41 def bottom_left(char) model.bottom_left = char end |
#bottom_right(char) ⇒ String Also known as: bottom_right=
57 58 59 |
# File 'lib/vedeu/borders/dsl.rb', line 57 def bottom_right(char) model.bottom_right = char end |
#caption(value) ⇒ String Also known as: caption=
256 257 258 |
# File 'lib/vedeu/borders/dsl.rb', line 256 def caption(value) model.caption = value end |
#colour(attrs = {}) ⇒ Vedeu::Colours::Colour Also known as: colour= Originally defined in module DSL::Presentation
Rejects invalid keys and empty/nil attributes. Also, the last defined colour for a particular interface, line or stream overrides previously defined entries in the same block.
Define either or both foreground and background colours for an interface, line or a stream. At least one attribute is required.
#colour_attributes ⇒ Hash<Symbol => String> (private) Originally defined in module DSL::Presentation
#disable! ⇒ Boolean
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vedeu/borders/dsl.rb', line 70 def disable! model.enabled = false hide_bottom! hide_left! hide_right! hide_top! model.enabled end |
#enable! ⇒ Boolean
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/vedeu/borders/dsl.rb', line 91 def enable! model.enabled = true show_bottom! show_left! show_right! show_top! model.enabled end |
#foreground(value = '') ⇒ Object Also known as: fg, fgcolor, foreground=, fg=, fgcolor= Originally defined in module DSL::Presentation
#hide_bottom! ⇒ Object
Disable the bottom border.
142 143 144 |
# File 'lib/vedeu/borders/dsl.rb', line 142 def hide_bottom! bottom(false) end |
#hide_left! ⇒ Object
Disable the left border.
177 178 179 |
# File 'lib/vedeu/borders/dsl.rb', line 177 def hide_left! left(false) end |
#hide_right! ⇒ Object
Disable the right border.
212 213 214 |
# File 'lib/vedeu/borders/dsl.rb', line 212 def hide_right! right(false) end |
#hide_top! ⇒ Object
Disable the top border.
285 286 287 |
# File 'lib/vedeu/borders/dsl.rb', line 285 def hide_top! top(false) end |
#horizontal(char) ⇒ String Also known as: horizontal=
113 114 115 |
# File 'lib/vedeu/borders/dsl.rb', line 113 def horizontal(char) model.horizontal = char end |
#initialize(model, client = nil) ⇒ void Originally defined in module DSL
Returns an instance of the DSL class including Vedeu::DSL.
#left(value) ⇒ Boolean Also known as: show_left, left=
166 167 168 169 170 |
# File 'lib/vedeu/borders/dsl.rb', line 166 def left(value) boolean = value ? true : false model.show_left = boolean end |
#right(value) ⇒ Boolean Also known as: show_right, right=
201 202 203 204 205 |
# File 'lib/vedeu/borders/dsl.rb', line 201 def right(value) boolean = value ? true : false model.show_right = boolean end |
#show_bottom! ⇒ Object
Enable the bottom border.
149 150 151 |
# File 'lib/vedeu/borders/dsl.rb', line 149 def show_bottom! bottom(true) end |
#show_left! ⇒ Object
Enable the left border.
184 185 186 |
# File 'lib/vedeu/borders/dsl.rb', line 184 def show_left! left(true) end |
#show_right! ⇒ Object
Enable the right border.
219 220 221 |
# File 'lib/vedeu/borders/dsl.rb', line 219 def show_right! right(true) end |
#show_top! ⇒ Object
Enable the top border.
292 293 294 |
# File 'lib/vedeu/borders/dsl.rb', line 292 def show_top! top(true) end |
#style(value) ⇒ Vedeu::Presentation::Style Also known as: style=, styles, styles= Originally defined in module DSL::Presentation
Define a style or styles for an interface, line or a stream.
#title(value) ⇒ String Also known as: title=
237 238 239 |
# File 'lib/vedeu/borders/dsl.rb', line 237 def title(value) model.title = value end |
#top(value) ⇒ Boolean Also known as: show_top, top=
274 275 276 277 278 |
# File 'lib/vedeu/borders/dsl.rb', line 274 def top(value) boolean = value ? true : false model.show_top = boolean end |
#top_left(char) ⇒ String Also known as: top_left=
307 308 309 |
# File 'lib/vedeu/borders/dsl.rb', line 307 def top_left(char) model.top_left = char end |
#top_right(char) ⇒ String Also known as: top_right=
323 324 325 |
# File 'lib/vedeu/borders/dsl.rb', line 323 def top_right(char) model.top_right = char end |
#use(name) ⇒ void Originally defined in module DSL::Use
-
Only models of the same repository can be used in this way.
-
If the stored model cannot be found, a ModelNotFound exception may be raised, or the request for an attribute may raise a NoMethodError exception.
This method returns an undefined value.
Use the attribute of stored model.
This DSL method provides access to a stored model by name. You can then request an attribute of that model for use within the current model. The models which current support this are Border, Geometry and Interface.