Class: AsciiParadise::AsciiTable::Style
- Inherits:
-
Object
- Object
- AsciiParadise::AsciiTable::Style
- Defined in:
- lib/ascii_paradise/asciitable/style.rb
Constant Summary collapse
- DEFAULTS =
#
DEFAULTS
Three different tokens are possible as border style, which are ‘-’,‘|’ and ‘+’.
#
{ border_x: '-', border_y: '|', border_i: '+', # 3 borders. padding_left: 1, padding_right: 1, width: nil }
Instance Attribute Summary collapse
-
#border_i ⇒ Object
Returns the value of attribute border_i.
-
#border_x ⇒ Object
Returns the value of attribute border_x.
-
#border_y ⇒ Object
Returns the value of attribute border_y.
-
#padding_left ⇒ Object
Returns the value of attribute padding_left.
-
#padding_right ⇒ Object
Returns the value of attribute padding_right.
Class Method Summary collapse
-
.defaults ⇒ Object
# === Style.defaults ========================================================================= #.
-
.defaults=(i) ⇒ Object
# === Style.defaults= ========================================================================= #.
Instance Method Summary collapse
-
#apply(i) ⇒ Object
# === apply.
-
#initialize(i = {}) ⇒ Style
constructor
# === initialize ========================================================================= #.
-
#width=(i) ⇒ Object
# === width= ========================================================================= #.
-
#width? ⇒ Boolean
(also: #width)
# === width? ========================================================================= #.
Constructor Details
#initialize(i = {}) ⇒ Style
#
initialize
#
60 61 62 63 64 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 60 def initialize(i = {}) apply( self.class.defaults.merge(i) ) end |
Instance Attribute Details
#border_i ⇒ Object
Returns the value of attribute border_i.
38 39 40 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 38 def border_i @border_i end |
#border_x ⇒ Object
Returns the value of attribute border_x.
36 37 38 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 36 def border_x @border_x end |
#border_y ⇒ Object
Returns the value of attribute border_y.
37 38 39 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 37 def border_y @border_y end |
#padding_left ⇒ Object
Returns the value of attribute padding_left.
39 40 41 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 39 def padding_left @padding_left end |
#padding_right ⇒ Object
Returns the value of attribute padding_right.
40 41 42 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 40 def padding_right @padding_right end |
Class Method Details
.defaults ⇒ Object
#
Style.defaults
#
78 79 80 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 78 def self.defaults # Can be called like so: Style.defaults DEFAULTS end |
.defaults=(i) ⇒ Object
#
Style.defaults=
#
85 86 87 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 85 def self.defaults=(i) defaults.merge(i) # Call the above method here. end |
Instance Method Details
#apply(i) ⇒ Object
#
apply
The input to this method should be an Array.
#
71 72 73 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 71 def apply(i) i.each { |m, v| __send__ "#{m}=", v } end |
#width=(i) ⇒ Object
#
width=
#
99 100 101 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 99 def width=(i) @width = i end |
#width? ⇒ Boolean Also known as: width
#
width?
#
92 93 94 |
# File 'lib/ascii_paradise/asciitable/style.rb', line 92 def width? @width end |