Class: Vedeu::Borders::DSL
Overview
Provides a mechanism to help configure borders in Vedeu.
Instance Attribute Summary
Attributes included from DSL
#client, #model
Class Method Summary
collapse
Instance Method Summary
collapse
-
#attrs(value, options) ⇒ Hash<Symbol => void>
private
-
#bottom(value) ⇒ Boolean
(also: #show_bottom, #bottom=)
-
#bottom_horizontal(char, options = {}) ⇒ String
(also: #bottom_horizontal=)
-
#bottom_left(char, options = {}) ⇒ String
(also: #bottom_left=)
-
#bottom_right(char, options = {}) ⇒ String
(also: #bottom_right=)
-
#caption(value) ⇒ String
(also: #caption=)
-
#default_options ⇒ Hash<Symbol => NilClass|String|Symbol>
private
-
#disable! ⇒ Boolean
(also: #disabled!)
-
#enable! ⇒ Boolean
(also: #enabled!)
-
#hide_bottom! ⇒ Object
Disable the bottom border.
-
#hide_left! ⇒ Object
-
#hide_right! ⇒ Object
Disable the right border.
-
#hide_top! ⇒ Object
-
#horizontal(char, options = {}) ⇒ String
(also: #horizontal=)
-
#left(value) ⇒ Boolean
(also: #show_left, #left=)
-
#left_vertical(char, options = {}) ⇒ String
(also: #left_vertical=)
-
#right(value) ⇒ Boolean
(also: #show_right, #right=)
-
#right_vertical(char, options = {}) ⇒ String
(also: #right_vertical=)
-
#show_bottom! ⇒ Object
Enable the bottom border.
-
#show_left! ⇒ Object
-
#show_right! ⇒ Object
-
#show_top! ⇒ Object
-
#title(value) ⇒ String
(also: #title=)
-
#top(value) ⇒ Boolean
(also: #show_top, #top=)
-
#top_horizontal(char, options = {}) ⇒ String
(also: #top_horizontal=)
-
#top_left(char, options = {}) ⇒ String
(also: #top_left=)
-
#top_right(char, options = {}) ⇒ String
(also: #top_right=)
-
#vertical(char, options = {}) ⇒ String
(also: #vertical=)
Methods included from DSL::Use
#use
#background, #colour, #colour_attributes, #foreground, #no_wordwrap!, #style, #wordwrap
included
Methods included from DSL
#attributes, #initialize, #method_missing, #name
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Vedeu::DSL
Instance Method Details
#attrs(value, options) ⇒ Hash<Symbol => void>
316
317
318
|
# File 'lib/vedeu/borders/dsl.rb', line 316
def attrs(value, options)
default_options.merge!(value: value).merge!(options)
end
|
#bottom(value) ⇒ Boolean
Also known as:
show_bottom, bottom=
128
129
130
131
132
|
# File 'lib/vedeu/borders/dsl.rb', line 128
def bottom(value)
boolean = value ? true : false
model.show_bottom = boolean
end
|
#bottom_horizontal(char, options = {}) ⇒ String
Also known as:
bottom_horizontal=
105
106
107
108
|
# File 'lib/vedeu/borders/dsl.rb', line 105
def bottom_horizontal(char, options = {})
model.bottom_horizontal = Vedeu::Cells::BottomHorizontal
.new(attrs(char, options))
end
|
#bottom_left(char, options = {}) ⇒ String
Also known as:
bottom_left=
37
38
39
|
# File 'lib/vedeu/borders/dsl.rb', line 37
def bottom_left(char, options = {})
model.bottom_left = Vedeu::Cells::BottomLeft.new(attrs(char, options))
end
|
#bottom_right(char, options = {}) ⇒ String
Also known as:
bottom_right=
50
51
52
|
# File 'lib/vedeu/borders/dsl.rb', line 50
def bottom_right(char, options = {})
model.bottom_right = Vedeu::Cells::BottomRight.new(attrs(char, options))
end
|
#caption(value) ⇒ String
Also known as:
caption=
214
215
216
217
|
# File 'lib/vedeu/borders/dsl.rb', line 214
def caption(value)
model.caption = value
model.caption
end
|
#default_options ⇒ Hash<Symbol => NilClass|String|Symbol>
321
322
323
324
325
326
327
328
|
# File 'lib/vedeu/borders/dsl.rb', line 321
def default_options
{
colour: model.colour,
name: model.name,
style: model.style,
value: nil,
}
end
|
#disable! ⇒ Boolean
Also known as:
disabled!
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/vedeu/borders/dsl.rb', line 57
def disable!
model.enabled = false
hide_bottom!
hide_left!
hide_right!
hide_top!
model.enabled
end
|
#enable! ⇒ Boolean
Also known as:
enabled!
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/vedeu/borders/dsl.rb', line 71
def enable!
model.enabled = true
show_bottom!
show_left!
show_right!
show_top!
model.enabled
end
|
#hide_bottom! ⇒ Object
Disable the bottom border.
139
140
141
|
# File 'lib/vedeu/borders/dsl.rb', line 139
def hide_bottom!
bottom(false)
end
|
#hide_left! ⇒ Object
165
166
167
|
# File 'lib/vedeu/borders/dsl.rb', line 165
def hide_left!
left(false)
end
|
#hide_right! ⇒ Object
Disable the right border.
191
192
193
|
# File 'lib/vedeu/borders/dsl.rb', line 191
def hide_right!
right(false)
end
|
#hide_top! ⇒ Object
235
236
237
|
# File 'lib/vedeu/borders/dsl.rb', line 235
def hide_top!
top(false)
end
|
#horizontal(char, options = {}) ⇒ String
Also known as:
horizontal=
119
120
121
|
# File 'lib/vedeu/borders/dsl.rb', line 119
def horizontal(char, options = {})
model.horizontal = Vedeu::Cells::Horizontal.new(attrs(char, options))
end
|
#left(value) ⇒ Boolean
Also known as:
show_left, left=
154
155
156
157
158
|
# File 'lib/vedeu/borders/dsl.rb', line 154
def left(value)
boolean = value ? true : false
model.show_left = boolean
end
|
#left_vertical(char, options = {}) ⇒ String
Also known as:
left_vertical=
280
281
282
283
|
# File 'lib/vedeu/borders/dsl.rb', line 280
def left_vertical(char, options = {})
model.left_vertical = Vedeu::Cells::LeftVertical
.new(attrs(char, options))
end
|
#right(value) ⇒ Boolean
Also known as:
show_right, right=
180
181
182
183
184
|
# File 'lib/vedeu/borders/dsl.rb', line 180
def right(value)
boolean = value ? true : false
model.show_right = boolean
end
|
#right_vertical(char, options = {}) ⇒ String
Also known as:
right_vertical=
294
295
296
297
|
# File 'lib/vedeu/borders/dsl.rb', line 294
def right_vertical(char, options = {})
model.right_vertical = Vedeu::Cells::RightVertical
.new(attrs(char, options))
end
|
#show_bottom! ⇒ Object
Enable the bottom border.
146
147
148
|
# File 'lib/vedeu/borders/dsl.rb', line 146
def show_bottom!
bottom(true)
end
|
#show_left! ⇒ Object
172
173
174
|
# File 'lib/vedeu/borders/dsl.rb', line 172
def show_left!
left(true)
end
|
#show_right! ⇒ Object
198
199
200
|
# File 'lib/vedeu/borders/dsl.rb', line 198
def show_right!
right(true)
end
|
#show_top! ⇒ Object
242
243
244
|
# File 'lib/vedeu/borders/dsl.rb', line 242
def show_top!
top(true)
end
|
#title(value) ⇒ String
Also known as:
title=
205
206
207
208
|
# File 'lib/vedeu/borders/dsl.rb', line 205
def title(value)
model.title = value
model.title
end
|
#top(value) ⇒ Boolean
Also known as:
show_top, top=
224
225
226
227
228
|
# File 'lib/vedeu/borders/dsl.rb', line 224
def top(value)
boolean = value ? true : false
model.show_top = boolean
end
|
#top_horizontal(char, options = {}) ⇒ String
Also known as:
top_horizontal=
91
92
93
94
|
# File 'lib/vedeu/borders/dsl.rb', line 91
def top_horizontal(char, options = {})
model.top_horizontal = Vedeu::Cells::TopHorizontal
.new(attrs(char, options))
end
|
#top_left(char, options = {}) ⇒ String
Also known as:
top_left=
254
255
256
|
# File 'lib/vedeu/borders/dsl.rb', line 254
def top_left(char, options = {})
model.top_left = Vedeu::Cells::TopLeft.new(attrs(char, options))
end
|
#top_right(char, options = {}) ⇒ String
Also known as:
top_right=
267
268
269
|
# File 'lib/vedeu/borders/dsl.rb', line 267
def top_right(char, options = {})
model.top_right = Vedeu::Cells::TopRight.new(attrs(char, options))
end
|
#vertical(char, options = {}) ⇒ String
Also known as:
vertical=
308
309
310
|
# File 'lib/vedeu/borders/dsl.rb', line 308
def vertical(char, options = {})
model.vertical = Vedeu::Cells::Vertical.new(attrs(char, options))
end
|