Class: Spark::Grid::Column
- Inherits:
-
Component::Base
- Object
- ActionView::Component::Base
- Component::Base
- Spark::Grid::Column
- Defined in:
- app/components/spark/grid/column.rb
Constant Summary collapse
- SPAN_NAME =
{ half: 6, third: 4, fourth: 3, sixth: 2 }.freeze
- SPAN =
[*(1..12), *SPAN_NAME.keys, :auto].freeze
- OFFSET =
[*(1..11), *SPAN_NAME.keys].freeze
Instance Method Summary collapse
-
#initialize ⇒ Column
constructor
A new instance of Column.
- #span_name(size) ⇒ Object
Methods inherited from Component::Base
Constructor Details
#initialize ⇒ Column
Returns a new instance of Column.
14 15 16 17 18 |
# File 'app/components/spark/grid/column.rb', line 14 def initialize(*) super classname.base = "spark-grid-column" classname.add("expand-content") if @expand_content end |
Instance Method Details
#span_name(size) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/spark/grid/column.rb', line 20 def span_name(size) return if size.nil? if size.is_a? Integer SPAN[size - 1] elsif size.is_a? Float SPAN[(SPAN.size * size) - 1] elsif size = SPAN_NAME[size.to_sym] SPAN[(12 / size) - 1] end end |