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
Attributes included from DSL
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
-
#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.
-
#disable! ⇒ Boolean
Disable the border:.
-
#enable! ⇒ Boolean
Enable the border: (Borders are enabled by default when defined for an interface).
-
#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) ⇒ Vedeu::Borders::DSL
constructor
Returns an instance of Borders::DSL.
-
#left(value) ⇒ Boolean
(also: #show_left, #left=)
Enable/disable the left border.
-
#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.
-
#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.
-
#vertical(char) ⇒ String
(also: #vertical=)
Set the character to be used to draw a vertical part of the border.
Methods included from DSL::Use
Methods included from DSL::Presentation
#background, #colour, #colour_attributes, #foreground, #style
Methods included from DSL
Constructor Details
#initialize(model, client = nil) ⇒ Vedeu::Borders::DSL
Returns an instance of Borders::DSL.
36 37 38 39 |
# File 'lib/vedeu/borders/dsl.rb', line 36 def initialize(model, client = nil) @model = model @client = client end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vedeu::DSL
Class Method Details
.border(name, &block) ⇒ Vedeu::Borders::Border
25 26 27 28 29 |
# File 'lib/vedeu/borders/dsl.rb', line 25 def self.border(name, &block) fail Vedeu::Error::InvalidSyntax, 'block not given' unless block_given? Vedeu::Borders::Border.build(enabled: true, name: name, &block).store end |
Instance Method Details
#bottom(value) ⇒ Boolean Also known as: show_bottom, bottom=
142 143 144 145 146 |
# File 'lib/vedeu/borders/dsl.rb', line 142 def bottom(value) boolean = value ? true : false model.show_bottom = boolean end |
#bottom_left(char) ⇒ String Also known as: bottom_left=
52 53 54 |
# File 'lib/vedeu/borders/dsl.rb', line 52 def bottom_left(char) model.bottom_left = char end |
#bottom_right(char) ⇒ String Also known as: bottom_right=
68 69 70 |
# File 'lib/vedeu/borders/dsl.rb', line 68 def bottom_right(char) model.bottom_right = char end |
#caption(value) ⇒ String Also known as: caption=
267 268 269 |
# File 'lib/vedeu/borders/dsl.rb', line 267 def caption(value) model.caption = value end |
#disable! ⇒ Boolean
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/vedeu/borders/dsl.rb', line 81 def disable! model.enabled = false hide_bottom! hide_left! hide_right! hide_top! model.enabled end |
#enable! ⇒ Boolean
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/vedeu/borders/dsl.rb', line 102 def enable! model.enabled = true show_bottom! show_left! show_right! show_top! model.enabled end |
#hide_bottom! ⇒ Object
Disable the bottom border.
153 154 155 |
# File 'lib/vedeu/borders/dsl.rb', line 153 def hide_bottom! bottom(false) end |
#hide_left! ⇒ Object
Disable the left border.
188 189 190 |
# File 'lib/vedeu/borders/dsl.rb', line 188 def hide_left! left(false) end |
#hide_right! ⇒ Object
Disable the right border.
223 224 225 |
# File 'lib/vedeu/borders/dsl.rb', line 223 def hide_right! right(false) end |
#hide_top! ⇒ Object
Disable the top border.
296 297 298 |
# File 'lib/vedeu/borders/dsl.rb', line 296 def hide_top! top(false) end |
#horizontal(char) ⇒ String Also known as: horizontal=
124 125 126 |
# File 'lib/vedeu/borders/dsl.rb', line 124 def horizontal(char) model.horizontal = char end |
#left(value) ⇒ Boolean Also known as: show_left, left=
177 178 179 180 181 |
# File 'lib/vedeu/borders/dsl.rb', line 177 def left(value) boolean = value ? true : false model.show_left = boolean end |
#right(value) ⇒ Boolean Also known as: show_right, right=
212 213 214 215 216 |
# File 'lib/vedeu/borders/dsl.rb', line 212 def right(value) boolean = value ? true : false model.show_right = boolean end |
#show_bottom! ⇒ Object
Enable the bottom border.
160 161 162 |
# File 'lib/vedeu/borders/dsl.rb', line 160 def show_bottom! bottom(true) end |
#show_left! ⇒ Object
Enable the left border.
195 196 197 |
# File 'lib/vedeu/borders/dsl.rb', line 195 def show_left! left(true) end |
#show_right! ⇒ Object
Enable the right border.
230 231 232 |
# File 'lib/vedeu/borders/dsl.rb', line 230 def show_right! right(true) end |
#show_top! ⇒ Object
Enable the top border.
303 304 305 |
# File 'lib/vedeu/borders/dsl.rb', line 303 def show_top! top(true) end |
#title(value) ⇒ String Also known as: title=
248 249 250 |
# File 'lib/vedeu/borders/dsl.rb', line 248 def title(value) model.title = value end |
#top(value) ⇒ Boolean Also known as: show_top, top=
285 286 287 288 289 |
# File 'lib/vedeu/borders/dsl.rb', line 285 def top(value) boolean = value ? true : false model.show_top = boolean end |
#top_left(char) ⇒ String Also known as: top_left=
318 319 320 |
# File 'lib/vedeu/borders/dsl.rb', line 318 def top_left(char) model.top_left = char end |
#top_right(char) ⇒ String Also known as: top_right=
334 335 336 |
# File 'lib/vedeu/borders/dsl.rb', line 334 def top_right(char) model.top_right = char end |