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>
310
311
312
|
# File 'lib/vedeu/borders/dsl.rb', line 310
def attrs(value, options)
default_options.merge!(value: value).merge!(options)
end
|
#bottom(value) ⇒ Boolean
Also known as:
show_bottom, bottom=
130
131
132
|
# File 'lib/vedeu/borders/dsl.rb', line 130
def bottom(value)
model.show_bottom = Vedeu::Boolean.coerce(value)
end
|
#bottom_horizontal(char, options = {}) ⇒ String
Also known as:
bottom_horizontal=
107
108
109
110
|
# File 'lib/vedeu/borders/dsl.rb', line 107
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=
39
40
41
|
# File 'lib/vedeu/borders/dsl.rb', line 39
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=
52
53
54
|
# File 'lib/vedeu/borders/dsl.rb', line 52
def bottom_right(char, options = {})
model.bottom_right = Vedeu::Cells::BottomRight.new(attrs(char, options))
end
|
#caption(value) ⇒ String
Also known as:
caption=
210
211
212
213
|
# File 'lib/vedeu/borders/dsl.rb', line 210
def caption(value)
model.caption = value
model.caption
end
|
#default_options ⇒ Hash<Symbol => NilClass|String|Symbol>
315
316
317
318
319
320
321
322
|
# File 'lib/vedeu/borders/dsl.rb', line 315
def default_options
{
colour: model.colour,
name: model.name,
style: model.style,
value: nil,
}
end
|
#disable! ⇒ Boolean
Also known as:
disabled!
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/vedeu/borders/dsl.rb', line 59
def disable!
model.enabled = false
hide_bottom!
hide_left!
hide_right!
hide_top!
model.enabled
end
|
#enable! ⇒ Boolean
Also known as:
enabled!
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/vedeu/borders/dsl.rb', line 73
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
163
164
165
|
# File 'lib/vedeu/borders/dsl.rb', line 163
def hide_left!
left(false)
end
|
#hide_right! ⇒ Object
Disable the right border.
187
188
189
|
# File 'lib/vedeu/borders/dsl.rb', line 187
def hide_right!
right(false)
end
|
#hide_top! ⇒ Object
229
230
231
|
# File 'lib/vedeu/borders/dsl.rb', line 229
def hide_top!
top(false)
end
|
#horizontal(char, options = {}) ⇒ String
Also known as:
horizontal=
121
122
123
|
# File 'lib/vedeu/borders/dsl.rb', line 121
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
|
# File 'lib/vedeu/borders/dsl.rb', line 154
def left(value)
model.show_left = Vedeu::Boolean.coerce(value)
end
|
#left_vertical(char, options = {}) ⇒ String
Also known as:
left_vertical=
274
275
276
277
|
# File 'lib/vedeu/borders/dsl.rb', line 274
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=
178
179
180
|
# File 'lib/vedeu/borders/dsl.rb', line 178
def right(value)
model.show_right = Vedeu::Boolean.coerce(value)
end
|
#right_vertical(char, options = {}) ⇒ String
Also known as:
right_vertical=
288
289
290
291
|
# File 'lib/vedeu/borders/dsl.rb', line 288
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
170
171
172
|
# File 'lib/vedeu/borders/dsl.rb', line 170
def show_left!
left(true)
end
|
#show_right! ⇒ Object
194
195
196
|
# File 'lib/vedeu/borders/dsl.rb', line 194
def show_right!
right(true)
end
|
#show_top! ⇒ Object
236
237
238
|
# File 'lib/vedeu/borders/dsl.rb', line 236
def show_top!
top(true)
end
|
#title(value) ⇒ String
Also known as:
title=
201
202
203
204
|
# File 'lib/vedeu/borders/dsl.rb', line 201
def title(value)
model.title = value
model.title
end
|
#top(value) ⇒ Boolean
Also known as:
show_top, top=
220
221
222
|
# File 'lib/vedeu/borders/dsl.rb', line 220
def top(value)
model.show_top = Vedeu::Boolean.coerce(value)
end
|
#top_horizontal(char, options = {}) ⇒ String
Also known as:
top_horizontal=
93
94
95
96
|
# File 'lib/vedeu/borders/dsl.rb', line 93
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=
248
249
250
|
# File 'lib/vedeu/borders/dsl.rb', line 248
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=
261
262
263
|
# File 'lib/vedeu/borders/dsl.rb', line 261
def top_right(char, options = {})
model.top_right = Vedeu::Cells::TopRight.new(attrs(char, options))
end
|
#vertical(char, options = {}) ⇒ String
Also known as:
vertical=
302
303
304
|
# File 'lib/vedeu/borders/dsl.rb', line 302
def vertical(char, options = {})
model.vertical = Vedeu::Cells::Vertical.new(attrs(char, options))
end
|