Class: Vedeu::DSL::Border
- Inherits:
-
Object
- Object
- Vedeu::DSL::Border
- Includes:
- Vedeu::DSL, Colour, Style
- 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 private
- #model ⇒ Border readonly private
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(boolean) ⇒ 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
- #hide_left! ⇒ Object
- #hide_right! ⇒ Object
- #hide_top! ⇒ Object
-
#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(boolean) ⇒ Boolean
(also: #show_left)
Enable/disable the left border.
-
#right(boolean) ⇒ Boolean
(also: #show_right)
Enable/disable the right border.
- #show_bottom! ⇒ Object
- #show_left! ⇒ Object
- #show_right! ⇒ Object
- #show_top! ⇒ Object
-
#top(boolean) ⇒ 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 Style
Methods included from Colour
#background, #colour, #foreground
Methods included from Vedeu::DSL
Constructor Details
#initialize(model, client = nil) ⇒ Vedeu::DSL::Border
Returns an instance of DSL::Border.
53 54 55 56 |
# File 'lib/vedeu/dsl/components/border.rb', line 53 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, private)
279 280 281 |
# File 'lib/vedeu/dsl/components/border.rb', line 279 def client @client end |
#model ⇒ Border (readonly, private)
282 283 284 |
# File 'lib/vedeu/dsl/components/border.rb', line 282 def model @model end |
Class Method Details
.border(name, &block) ⇒ Vedeu::Border
Specify the border of an interface or view with a simple DSL.
42 43 44 45 46 |
# File 'lib/vedeu/dsl/components/border.rb', line 42 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(boolean) ⇒ Boolean Also known as: show_bottom
Enable/disable the bottom border.
123 124 125 |
# File 'lib/vedeu/dsl/components/border.rb', line 123 def bottom(boolean) model.show_bottom = !!boolean end |
#bottom_left(char) ⇒ String
Set the character to be used to draw the bottom left corner of the border.
71 72 73 |
# File 'lib/vedeu/dsl/components/border.rb', line 71 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.
88 89 90 |
# File 'lib/vedeu/dsl/components/border.rb', line 88 def bottom_right(char) model.bottom_right = char end |
#hide_bottom! ⇒ Object
129 130 131 |
# File 'lib/vedeu/dsl/components/border.rb', line 129 def hide_bottom! bottom(false) end |
#hide_left! ⇒ Object
159 160 161 |
# File 'lib/vedeu/dsl/components/border.rb', line 159 def hide_left! left(false) end |
#hide_right! ⇒ Object
189 190 191 |
# File 'lib/vedeu/dsl/components/border.rb', line 189 def hide_right! right(false) end |
#hide_top! ⇒ Object
219 220 221 |
# File 'lib/vedeu/dsl/components/border.rb', line 219 def hide_top! top(false) end |
#horizontal(char) ⇒ String
Set the character to be used to draw a horizontal part of the border.
104 105 106 |
# File 'lib/vedeu/dsl/components/border.rb', line 104 def horizontal(char) model.horizontal = char end |
#left(boolean) ⇒ Boolean Also known as: show_left
Enable/disable the left border.
153 154 155 |
# File 'lib/vedeu/dsl/components/border.rb', line 153 def left(boolean) model.show_left = !!boolean end |
#right(boolean) ⇒ Boolean Also known as: show_right
Enable/disable the right border.
183 184 185 |
# File 'lib/vedeu/dsl/components/border.rb', line 183 def right(boolean) model.show_right = !!boolean end |
#show_bottom! ⇒ Object
134 135 136 |
# File 'lib/vedeu/dsl/components/border.rb', line 134 def show_bottom! bottom(true) end |
#show_left! ⇒ Object
164 165 166 |
# File 'lib/vedeu/dsl/components/border.rb', line 164 def show_left! left(true) end |
#show_right! ⇒ Object
194 195 196 |
# File 'lib/vedeu/dsl/components/border.rb', line 194 def show_right! right(true) end |
#show_top! ⇒ Object
224 225 226 |
# File 'lib/vedeu/dsl/components/border.rb', line 224 def show_top! top(true) end |
#top(boolean) ⇒ Boolean Also known as: show_top
Enable/disable the top border.
213 214 215 |
# File 'lib/vedeu/dsl/components/border.rb', line 213 def top(boolean) model.show_top = !!boolean end |
#top_left(char) ⇒ String
Set the character to be used to draw the top left corner of the border.
240 241 242 |
# File 'lib/vedeu/dsl/components/border.rb', line 240 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.
256 257 258 |
# File 'lib/vedeu/dsl/components/border.rb', line 256 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.
272 273 274 |
# File 'lib/vedeu/dsl/components/border.rb', line 272 def vertical(char) model.vertical = char end |