Class: Maglove::Widgets::Columns
- Defined in:
- lib/maglove/widgets/columns.rb
Defined Under Namespace
Modules: Helpers
Instance Attribute Summary collapse
-
#column_count ⇒ Object
readonly
Returns the value of attribute column_count.
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#total_columns ⇒ Object
readonly
Returns the value of attribute total_columns.
Attributes inherited from Base
Instance Method Summary collapse
- #defaults ⇒ Object
- #identifier ⇒ Object
-
#initialize(options) ⇒ Columns
constructor
A new instance of Columns.
- #next_span ⇒ Object
- #row_options ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(options) ⇒ Columns
Returns a new instance of Columns.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/maglove/widgets/columns.rb', line 8 def initialize() super() @column_count = 0 column_array = @options[:columns].to_s.split("x") if column_array.length == 1 @total_columns = column_array[0].to_i @columns = Array.new(@total_columns) { 12 / @total_columns } else @total_columns = column_array.length @columns = column_array end end |
Instance Attribute Details
#column_count ⇒ Object (readonly)
Returns the value of attribute column_count.
5 6 7 |
# File 'lib/maglove/widgets/columns.rb', line 5 def column_count @column_count end |
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
4 5 6 |
# File 'lib/maglove/widgets/columns.rb', line 4 def columns @columns end |
#total_columns ⇒ Object (readonly)
Returns the value of attribute total_columns.
6 7 8 |
# File 'lib/maglove/widgets/columns.rb', line 6 def total_columns @total_columns end |
Instance Method Details
#defaults ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/maglove/widgets/columns.rb', line 38 def defaults { columns: "2", style: "default", margin_bottom: "", collapse_options: "sm" } end |
#identifier ⇒ Object
34 35 36 |
# File 'lib/maglove/widgets/columns.rb', line 34 def identifier "columns" end |
#next_span ⇒ Object
21 22 23 24 25 |
# File 'lib/maglove/widgets/columns.rb', line 21 def next_span value = @columns[@column_count] @column_count += 1 value end |
#row_options ⇒ Object
27 28 29 30 31 32 |
# File 'lib/maglove/widgets/columns.rb', line 27 def { class: "row row-#{@options[:style]}", style: style_string(@options, :margin_bottom) } end |