Class: Vedeu::DSL::Border
- Inherits:
-
Object
- Object
- Vedeu::DSL::Border
- Includes:
- Vedeu::DSL, Presentation
- Defined in:
- lib/vedeu/dsl/components/border.rb
Overview
DSL for creating borders for interfaces.
Allows customisation for the border’s sides and corners; a custom foreground and background, style, and whether a particular side should be drawn or not.
Instance Attribute Summary collapse
- #client ⇒ Object readonly protected
- #model ⇒ Border readonly protected
Class Method Summary collapse
-
.border(name, &block) ⇒ Vedeu::Border
Specify the border of an interface or view with a simple DSL.
Instance Method Summary collapse
-
#bottom(value) ⇒ Boolean
(also: #show_bottom)
Enable/disable the bottom border.
-
#bottom_left(char) ⇒ String
Set the character to be used to draw the bottom left corner of the border.
-
#bottom_right(char) ⇒ String
Set the character to be used to draw the bottom right corner of the border.
-
#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
Set the character to be used to draw a horizontal part of the border.
-
#initialize(model, client = nil) ⇒ Vedeu::DSL::Border
constructor
Returns an instance of DSL::Border.
-
#left(value) ⇒ Boolean
(also: #show_left)
Enable/disable the left border.
-
#right(value) ⇒ Boolean
(also: #show_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
If you have you are showing a top border, you could add a title.
-
#top(value) ⇒ Boolean
(also: #show_top)
Enable/disable the top border.
-
#top_left(char) ⇒ String
Set the character to be used to draw the top left corner of the border.
-
#top_right(char) ⇒ String
Set the character to be used to draw the top right corner of the border.
-
#vertical(char) ⇒ String
Set the character to be used to draw a vertical part of the border.
Methods included from Presentation
#background, #colour, #foreground, #style
Methods included from Vedeu::DSL
Constructor Details
#initialize(model, client = nil) ⇒ Vedeu::DSL::Border
Returns an instance of DSL::Border.
56 57 58 59 |
# File 'lib/vedeu/dsl/components/border.rb', line 56 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
Instance Attribute Details
#client ⇒ Object (readonly, protected)
325 326 327 |
# File 'lib/vedeu/dsl/components/border.rb', line 325 def client @client end |
#model ⇒ Border (readonly, protected)
329 330 331 |
# File 'lib/vedeu/dsl/components/border.rb', line 329 def model @model end |
Class Method Details
.border(name, &block) ⇒ Vedeu::Border
Specify the border of an interface or view with a simple DSL.
45 46 47 48 49 |
# File 'lib/vedeu/dsl/components/border.rb', line 45 def self.border(name, &block) fail InvalidSyntax, 'block not given' unless block_given? Vedeu::Border.build({ enabled: true, name: name }, &block).store end |
Instance Method Details
#bottom(value) ⇒ Boolean Also known as: show_bottom
Enable/disable the bottom border.
126 127 128 129 130 |
# File 'lib/vedeu/dsl/components/border.rb', line 126 def bottom(value) boolean = value ? true : false model.show_bottom = boolean end |
#bottom_left(char) ⇒ String
Set the character to be used to draw the bottom left corner of the border.
74 75 76 |
# File 'lib/vedeu/dsl/components/border.rb', line 74 def bottom_left(char) model.bottom_left = char end |
#bottom_right(char) ⇒ String
Set the character to be used to draw the bottom right corner of the border.
91 92 93 |
# File 'lib/vedeu/dsl/components/border.rb', line 91 def bottom_right(char) model.bottom_right = char end |
#hide_bottom! ⇒ Object
Disable the bottom border.
136 137 138 |
# File 'lib/vedeu/dsl/components/border.rb', line 136 def hide_bottom! bottom(false) end |
#hide_left! ⇒ Object
Disable the left border.
172 173 174 |
# File 'lib/vedeu/dsl/components/border.rb', line 172 def hide_left! left(false) end |
#hide_right! ⇒ Object
Disable the right border.
208 209 210 |
# File 'lib/vedeu/dsl/components/border.rb', line 208 def hide_right! right(false) end |
#hide_top! ⇒ Object
Disable the top border.
262 263 264 |
# File 'lib/vedeu/dsl/components/border.rb', line 262 def hide_top! top(false) end |
#horizontal(char) ⇒ String
Set the character to be used to draw a horizontal part of the border.
107 108 109 |
# File 'lib/vedeu/dsl/components/border.rb', line 107 def horizontal(char) model.horizontal = char end |
#left(value) ⇒ Boolean Also known as: show_left
Enable/disable the left border.
162 163 164 165 166 |
# File 'lib/vedeu/dsl/components/border.rb', line 162 def left(value) boolean = value ? true : false model.show_left = boolean end |
#right(value) ⇒ Boolean Also known as: show_right
Enable/disable the right border.
198 199 200 201 202 |
# File 'lib/vedeu/dsl/components/border.rb', line 198 def right(value) boolean = value ? true : false model.show_right = boolean end |
#show_bottom! ⇒ Object
Enable the bottom border.
143 144 145 |
# File 'lib/vedeu/dsl/components/border.rb', line 143 def show_bottom! bottom(true) end |
#show_left! ⇒ Object
Enable the left border.
179 180 181 |
# File 'lib/vedeu/dsl/components/border.rb', line 179 def show_left! left(true) end |
#show_right! ⇒ Object
Enable the right border.
215 216 217 |
# File 'lib/vedeu/dsl/components/border.rb', line 215 def show_right! right(true) end |
#show_top! ⇒ Object
Enable the top border.
269 270 271 |
# File 'lib/vedeu/dsl/components/border.rb', line 269 def show_top! top(true) end |
#title(value) ⇒ String
If you have you are showing a top border, you could add a title.
233 234 235 |
# File 'lib/vedeu/dsl/components/border.rb', line 233 def title(value) model.title = value end |
#top(value) ⇒ Boolean Also known as: show_top
Enable/disable the top border.
252 253 254 255 256 |
# File 'lib/vedeu/dsl/components/border.rb', line 252 def top(value) boolean = value ? true : false model.show_top = boolean end |
#top_left(char) ⇒ String
Set the character to be used to draw the top left corner of the border.
285 286 287 |
# File 'lib/vedeu/dsl/components/border.rb', line 285 def top_left(char) model.top_left = char end |
#top_right(char) ⇒ String
Set the character to be used to draw the top right corner of the border.
301 302 303 |
# File 'lib/vedeu/dsl/components/border.rb', line 301 def top_right(char) model.top_right = char end |
#vertical(char) ⇒ String
Set the character to be used to draw a vertical part of the border.
317 318 319 |
# File 'lib/vedeu/dsl/components/border.rb', line 317 def vertical(char) model.vertical = char end |